import { action, computed, observable, toJS } from 'mobx';
import ReactDOM from "react-dom";
import API from '../../apis';
import { message, Modal, Spin } from 'antd';
import window, { replaceE8Url, removeHTMLTag } from '../../util';
import CubeUtil from '../../cubeUtil';
import { WeaForm, WeaTableNew } from 'comsMobx';
import $ from "jquery";
import jQuery from "jquery";
import _, { uniq } from 'lodash';
import TopStore from './TopStore';
import AdvancedStore from './AdvancedStore';
import TemplateStore from './TemplateStore';
import ShareStore from './ShareStore';
import { ListEditStore } from './ListEditStore';
import BatchEditStore from './BatchEditStore';
import CardStore from '../card';
import { WeaLocaleProvider, WeaTools } from 'ecCom';
import EditTableStore from '../mobxTable/table';
import { getColumns } from '../mobxTable/list';
import CustomDialogStore from '../card/CustomDialog';
import { doExpCardConfig, getBarCode, getQRCode, getWaterMarkImg } from '../../apis/card';
import PaginationStore from '../../util/pagination';
import { getTableCounts, getTableDatas, setTablePageSize } from '../../apis/table';
import * as WaterMark from '../../pages/watermark';
import BatchAddStore from './BatchAddStore';
import { showExpendError, showExportMenu } from '../../util/cubeUtil';
import ExcelStore from './ExcelStore';
import { checkHref } from '../../util/typeUtil';
import { any } from 'prop-types';
import { modeList } from "../../util/searchUtil";
import VerticalListStore from './verticalListStore';
import * as React from "react";
import LittleCard from '../../components/list/littleCard/LittleCard';

const getParent = WeaTools.WindowFunc.getParent;
const { TableStore } = WeaTableNew;

const getLabel = WeaLocaleProvider.getLabel;

let flag1 = false;//批量修改保存按钮状态，多次点击保存按钮，只会发送一次请求
export enum SearchDisplayType {
    Excel = 'excel',
    Normal = 'normal',
    TreeType = 'treeType',
    ImgType = 'imgType',
    Empty = '',
    VerticalType = 'verticalType',  //纵向列表
}

export class listStore {
    host: HTMLDivElement | null;
    card: CardStore;

    constructor() {
        window.onresize = () => {
            // @ts-ignore
            this.height = document.documentElement.clientHeight;
        }
        this.modename = getLabel(83, '日志');
    }

    component = '';
    customId = '';
    modeId = '';
    formId = '';
    isDelShow = false;
    sessionKey = '';
    hasQuickSearch = false;
    hasKeySearch = false;
    disquerycheck = '';
    keySearchFields = [];
    keyFieldidInfo = {} as any;
    modename = '日志';
    nondefaultshared = false;
    defaultshared = false;
    treeFieldStr = '';
    urlMap = {} as any;
    confirmMap = {} as any;
    @observable tableData = {
        total: 0,
        Data: [],
    };
    @observable dataShowtype: string = 'normal' //列表的类型
    @observable treeData = [] as any[];     //分组显示数据
    @observable treeColumn = [] as any[];   //分组显示字段
    @observable treePercent = 0;
    @observable isExpTree = '';   //是否分组导出
    @observable rightMenus = [] as any[];
    @observable printEdcUrl = '';   //数据中心打印地址
    @observable tempRightMenus = [] as any[];
    @observable batchTempRightMenus = [] as any[];
    @observable height = 0;
    @observable viewResHeight = 0;//资源面板查询高度
    @observable params = {} as any;
    @observable customparms = {} as any;
    @observable query = {} as any;
    @observable viewtype = '';
    @observable type = 'advanced';
    @observable loading = false; // 加载中状态
    @observable top = new TopStore();
    @observable newTable = new TableStore();
    @observable quickSearchValue = '';
    @observable advanced = new AdvancedStore();
    @observable condition = new AdvancedStore();
    @observable treecolumns = [] as any[];     //查询分组显示
    @observable treedatas = [] as any[];     //查询分组显示
    @observable searchTree: any = {
        current: 1,
        pagesize: 10
    }
    @observable searchImg: any = {
        loading: false,
    }
    @observable treeDataWidth;          //用于计算树形展示的列宽
    @observable checkAdvanedData = '';  //用于高级查询必填字段的校验
    @observable changeDataTime = '';
    @observable pagesizetree = '';   //显示判断
    @observable isTreeSearch = '';   //显示判断
    @observable treeValueId = '';      //勾选的树组合显示的id值
    @observable changeSearch = '';     //查询树显示转换
    @observable enableTreeList = '';   //是否开启组合查询
    @observable isTreeType = '';   //是否开启组合查询
    @observable treeKey: string[];   //是否开启组合查询
    @observable isTree = false;
    @observable form = new WeaForm();
    @observable conditionInfo: any = [];
    @observable advancedInfo = [];
    @observable quickConditions = {};
    @observable quickConditionConfig = []
    @observable isShowCondition = false;
    @observable isfrontmultlang = false;
    @observable windowTitle = '';    //页面标题
    @observable printWindowTitle = '';    //打印页面标题（单独处理）
    @observable isBatchSubmit = true;    //数据修改冲突提醒后，不进行数据验证提交
    @observable listEditStore = new ListEditStore(this);
    @observable batchEditStore = new BatchEditStore();
    @observable copyDataSource;
    @observable copyIsNullField;  //记录高级查询最初始值
    @observable simpleDialogBody = null;
    @observable simpleDialog = {};
    @observable dialogVisible = false;
    @observable msgConfirmVisible = false;   //批量修改信息确认
    @observable msgConfirmData: any = null;   //批量修改数据暂存
    @observable msgConfirmOldData: any = null;   //批量修改老数据暂存
    @observable templateid = '';
    @observable template = new TemplateStore();
    @observable isInit = false;
    // @observable forceUpdate = false;//资源面板手动动态刷新列表高度
    // @observable listHeight = 250;//资源面板手动动态刷新列表高度
    @observable share = new ShareStore();
    @observable _isInnerTab: boolean = false;
    @observable reloadModeTop: any = {};
    @observable isInTree: boolean = false;

    @observable tagVisible: boolean = false;
    @observable sqlNeedKey: any = { randomkey: new Date().getTime() };
    @observable datalist: any = [];
    @observable mergeInfos: any = [];
    @observable mergeFields: any = [];
    @observable mergeTempColumns: any = [];
    @observable isEdit: boolean = false;
    @observable editTableStore: EditTableStore = new EditTableStore();
    @observable customDialog = new CustomDialogStore();
    @observable verified = false;
    @observable hasRight = false; //权限
    @observable quickSearchData: any = {}; //快速搜索数据
    @observable quickSearchDataWithNoChange: any = {}; //仅快速搜索处使用，记录空数据结构，不做改变
    @observable quickSearchFormData: any = {}; //快速搜索表单数据
    @observable isTempSearch = "";
    @observable selectedRowKeys: string[] = [];
    @observable slideModalVisible: boolean = false;
    @observable slideModalUrl = "";
    @observable slideModalUrlold = "";
    @observable sliderPercentage = "";
    @observable slideflgvla = "";
    @observable countReturn: number = 0;//优化数据渲染
    @observable dosubmitvla: boolean = false;
    @observable titleField: any;
    @observable imgPageRefresh: boolean = false;//相册的分页 刷新时不清空选项
    @observable selectRowkeys: any[] = [];//图形列表 + 纵向列表也用这个
    @observable imgSelectValue = "";//图形列表中主表id
    @observable dataShowInfo: any;
    @observable userInfo: any;
    // @observable displayTypeForImg: any;
    @observable isPagesizeForImg: boolean = false;
    @observable defalutPagesize = 0;
    @observable rowCheckKey: Array<string> = [];
    @observable iconInfo = {
        icon: "icon-coms-ModelingEngine",
        iconColor: "#fff",
        iconBg: "#96358a"
    }

    @observable cubeMap = {
        visible: false,
        location: ""
    }

    @observable countData: any = {}; //查询统计数据
    @observable isCharts: boolean = false; //查询统计数据
    @observable countDisplayPosition: string = ''; //统计-显示位置 '0':顶部显示、'1':顶部简约显示、'2':右上角显示
    @observable showMoreCountData: boolean = false; //是否显示下拉列表中的查询统计数据

    @observable waterImg: string = "";
    @observable dataBoard = null;
    @observable excelStore: ExcelStore;
    @observable starttime: any = new Date().getTime();
    @observable showProgerss: boolean = false;//是否显示导出进度
    @observable isCancel: boolean = false;//是否显示导出进度
    @observable isClose: boolean = false;//是否关闭进度条
    @observable progress: any = {};//是否显示导出进度
    @observable delLoadingProgress: any = {};//是否显示删除进度
    @observable exportkey: string = "";//导出唯一key
    @observable delkey: string = "";//删除唯一key
    @computed get isInnerTab() {
        return this._isInnerTab;
    }

    quickSearchConditionData: any = {}; //快速搜索输入的数据(用于浏览框动态参数)
    @observable batchAddStore = new BatchAddStore();
    @observable showExpList: boolean = false;//是否显示导出类型列表
    @observable expCardParm: any = {
        datas: [],
        billsid: '',
        modeid: '',
        type: 'list',
        comefrom: "",
        modeCustomid: "",
        dataKey: "",
        expcardname: '',
        callBack: ''
    };
    originalTableWidth;//列宽百分比

    //***************数据筛选相关******************* */
    @observable doRealAction: boolean = false; //是否执行真正的方法
    @observable checkBtn: any;//选中按钮标识
    @observable checkLoading: boolean = false;//数据筛选loading
    /**
     * 是否是批量导入数据还原
     */
    @observable isBackUpData: boolean = false;
    @observable backupDataLoading: boolean = false;//数据还原loading
    /**
     * 批量导入数据类型是否是覆盖(不是覆盖则是还原)
     */
    @observable isCoverType: boolean = false;
    tempTabledatas: any = {};// 按钮前的tableDatas
    tempselectedRowKeys: any = [];// 按钮前的选中项
    oldMenueKey: String = "";
    @observable
    filterSelectRows: any = [];//数据筛选能勾选的数据

    @observable interVal: any;
    @observable showGlobalSpin: any = { //代码块中 控制全局spin
        isShow: 'none',
    };
    //******************************************** */

    secondflag = true; //判断是否需要二次验证
    reloadParams: any = ''; // 存储调用API.dataKey接口传递的参数，在register_table触发reload方法调用API.dataKey接口时需传递这些参数
    //行点击事件
    rowClick: any = {};
    search?: listStore = undefined;
    parentSearch?: listStore = undefined;
    isInSearch: boolean = false;
    @observable rightLayoutHref = '';
    @observable rightLayoutWidth: string = '0%';

    set isInnerTab(bol: boolean) {
        this._isInnerTab = bol;
    }

    clearTable = () => {
        this.newTable = new TableStore();
    }
    @observable editPagination = new PaginationStore();
    @observable requireTimes: number = 0; //用于判断是否是当前请求
    @observable requireTimesdata: number = 0;//用于判断是否是当前请求table
    @observable isSuspend: boolean = false;//是否悬浮显示自定义按钮
    @observable isShowIcon: boolean = false;//自定义按钮仅显示图标
    @observable showButtomNum: number = 5;//自定义按钮显示数量
    @observable verticalListStore: VerticalListStore = new VerticalListStore(this);
    @observable isclick: boolean = false;

    @computed
    get register_table() {
        return {
            reLoad: () => {
                this.reload();
                if (this.params.isRefreshTree == '1') {
                    (window as any).refreshTree(this.params.customTreeDataId);
                }
            }
        };
    }

    @computed get displayType(): SearchDisplayType {
        let type = this.params.displayType;
        if (!type || type !== SearchDisplayType.Excel) {
            type = this.dataShowtype;
        }
        return type;
    }

    @computed get tableDatas() {
        return this.newTable.datas;
    }

    @action
    changeIsInTree = () => {
        this.isInTree = true;
    }
    @action
    clear = () => {
        this.isInit = false;
        this.form = new WeaForm();
        this.form.isFormInit = false;
        this.newTable = new TableStore();
        this.top = new TopStore();
        this.advanced = new AdvancedStore();
        this.condition = new AdvancedStore();
        this.template = new TemplateStore();
        this.quickSearchValue = '';
        this.loading = false;
        this.formId = '';
        this.modeId = '';
        this.customId = '';
        this.sessionKey = '';
        this.hasQuickSearch = false;
        this.isShowCondition = false;
        this.isfrontmultlang = false;
        this.isEdit = false;
        this.rightMenus = [];
        this.tempRightMenus = [];
        this.waterImg = "";
        this.templateid = "";
        this._isInnerTab = false;
        this.confirmMap = {};
        this.checkBtn = '';
        this.oldMenueKey = '';
        this.doRealAction = false;
        // 相册
        this.selectRowkeys = [];
        this.verticalListStore = new VerticalListStore(this);
        this.rowClick = [];
        this.countData = {};
        this.countDisplayPosition = '';
        this.search=undefined;
        this.rightLayoutWidth='0%';
        this.rightLayoutHref='';
    }

    setSelectedRowKeys(rowKey: string[], value) {
        //树展示，最多五层结构，暂不写递归
        this.treeKey = [];
        if (value.length > 0) {
            value.map(item => {
                if (item.randomFieldCk != 'false') {
                    this.treeKey.push(item.key);
                }
                let { sublist } = item;
                if (sublist != undefined && sublist != '') {     //第二层
                    sublist.map(items => {
                        if (items.randomFieldCk != 'false') {
                            this.treeKey.push(items.key);
                        }
                        let { sublist } = items;
                        if (sublist != undefined && sublist != '') {     //第三层
                            sublist.map(it => {
                                if(it.randomFieldCk != 'false'){ this.treeKey.push(it.key);}
                                let { sublist } = it;
                                if (sublist != undefined && sublist != '') {    //第四层
                                    sublist.map(it => {
                                        if(it.randomFieldCk != 'false'){this.treeKey.push(it.key);}
                                        let { sublist } = it;
                                        if (sublist != undefined && sublist != '') {    //第五层
                                            sublist.map(it => {
                                                if(it.randomFieldCk != 'false'){this.treeKey.push(it.key);}
                                            })
                                        }
                                    })
                                }
                            })
                        }
                    })
                }
            })
        } else {
            this.treeKey = rowKey;
        }
        this.selectedRowKeys = this.treeKey;
    }

    // getRowKey(sublist){

    //     return
    // }
    resetTreeValueId = () => {
        this.treeValueId = "";
    }
    getSelectedRowKeys = () => {
        this.selectedRowKeys = [];
    }
    @action
    update = (param: any) => {
        for (let key in param) {
            if (param.hasOwnProperty(key)) {
                this[key] = param[key]
            }
        }
    }

    @action
    updateParams = (params: any) => {
        // let temp = !_.isEmpty(this.params) && !_.isEqual(toJS(this.params), params);  //这里存在矛盾，先去掉吧
        let temp = !_.isEqual(toJS(this.params), params);
        delete params._key; //浏览器回退时 _key值不变 会影响查询列表刷新。
        this.params = params;
        if (params.viewtype == '2') {   //高级搜索查询
            params.type = 'advanced';
        }
        if (temp) {
            this.reloadSearch(params);
        }
    }

    rightMenuClick = (key: string) => {
        if (key == '-1') {
            if (!this.isShowCondition) {
                this.condition.update({ visible: false });
            }
            this.refresh();
        } else if (key == '-2') {
            this.advanced.form.reset()
        } else if (key == '-3') {
            this.template.saveAsTemplate();
        }
        const rightMenus = this.rightMenus.filter(d => d.key == key);
        if (rightMenus.length == 0) {
            return;
        }
        const menu = rightMenus[0];
        return this.doCustomAction(menu);
    }

    @action
    init = ({ type = 'base', ...params }: any) => {
        let copyparams = {};
		this.copyDataSource = {};
        for (const key in params) {
            try {
                copyparams[key] = decodeURI(params[key]);
            } catch (error) {
                copyparams[key] = params[key];
            }
        }
        params = copyparams;
        //树工具栏相关
        if (params.fromToolBar && params.fromToolBar == '1') {
            this.quickSearchValue = params.quickSearchValue || '';
        }
        this.params = params;
        this.component = 'Search';
        this.viewtype = params.viewtype;
        this.type = type;
        if(!this.isInSearch){
            window._xtable_CheckedCheckboxId = () => {
                if (this.displayType === SearchDisplayType.Excel) {
                    return _.uniq(this.excelStore.selectedRowKeys).join(',');
                } else {
                    // this.newTable.datas.map(d => this.newTable.selectedRowKeys.indexOf(getListKey(d)) > -1).map(d => d.randomFieldId);
                    // return _.uniq(this.newTable.selectedRowKeys.map(d => d.split('_')[0])).join(',');
                    return _.uniq(this.newTable.selectedRowKeysAllPages.map(d => d.split('_')[0])).join(',');
                }
            }
            window._xtable_CleanCheckedCheckbox = () => {
                // this.newTable.setSelectedRowKeys([]);
                if (this.displayType === SearchDisplayType.Excel) {
                    this.excelStore.selectedRowKeys = [];
                } else if (this.displayType == SearchDisplayType.ImgType) {
                    this.selectRowKeyAll(true)
                } else if (this.displayType == SearchDisplayType.VerticalType) {
                    this.verticalListStore.selectRowKeyAll(true)
                } else {
                    this.newTable.setSelectedRowKeysAllPages([]);
                }
    
            }
        }
        //处理快速切换菜单多个异步请求，防止数据被覆盖
        const requireTimes = this.requireTimes;
        this.update({ requireTimes: requireTimes + 1 });
        API.initSearch(params).then(action(({ error, status, rowClick, top, rightMenus, printEdcUrl, quickSearch, nondefaultshared, defaultshare, isCharts, noRight, isfromTab = '', isfromRight = '', isImgType, datashowtype, excelFixed, dataBoard, originalTableWidth, pageSize, isBackUpData, secondPassword, isCoverType, ...props }) => {
            const requireTimesNow = this.requireTimes;
            this.rowClick = rowClick;
            if (requireTimesNow == requireTimes + 1) {
                if (secondPassword && this.secondflag) {
                    this.doSecondaryVirty(params);
                }
                if (noRight) {
                    this.hasRight = false;
                    this.verified = true;
                    this.isInit = true
                    return;
                } else {
                    this.originalTableWidth = originalTableWidth;
                    this.isBackUpData = isBackUpData;
                    this.isCoverType = isCoverType;
                    this.hasRight = true;
                    this.verified = true;
                    this.dataShowtype = datashowtype;
                    this.isPagesizeForImg = false;
                    this.defalutPagesize = pageSize;
                    this.searchTree = {
                        current: 1,
                        pagesize: pageSize
                    };
                    this.verticalListStore.update({ pageSize: pageSize || 10 });
                    if(pageSize && pageSize >0 && this.editPagination.pageSizeOptions.indexOf(pageSize) == -1){
                        this.editPagination.pageSizeOptions.push(pageSize);
                        this.editPagination.pageSizeOptions = this.editPagination.pageSizeOptions.sort((a, b) => {return a-b});
                    }
                    if (datashowtype === SearchDisplayType.ImgType) {
                        this.isPagesizeForImg = true;
                    }
                    //Excel方式展现列表
                    if (this.displayType === SearchDisplayType.Excel) {
                        params = { ...params, "displayType": "excel" }
                        this.excelStore = new ExcelStore(params);
                        if (datashowtype === SearchDisplayType.Excel) {
                            this.excelStore.setFiexdInfo(excelFixed);
                        }
                    }
                    this.toGetJsCodeArea('isBefore', () => {
                        this.rightMenus = rightMenus;
                        this.tempRightMenus = rightMenus;
                        this.getTemplate(params, true, (bool: boolean) => {
                            if (bool && this.type == "base") {
                                this.refresh();
                            } else {
                                this.getConditionOrAdvanced(params);
                            }
                        })
                    });
                }

                if (status == '1') {
                    this.getIconInfo(props.modeId);
                    this.update(props);
                    this.top.update(top);
                    if (top) {
                        if (top.selectedKey) {
                            this.top.selectedKey = top.selectedKey;
                        } else if (top.tabs && top.tabs.length > 0) {
                            this.top.selectedKey = top.tabs[0].key
                        }
                    }
                    this.top.isInit = true;
                    this.nondefaultshared = nondefaultshared;
                    this.defaultshared = defaultshare;
                    if (type == 'base') {
                        if (this.isShowCondition) {
                            this.condition.update({ visible: true })
                        } else {
                            this.condition.update({ visible: false })
                        }
                    }

                    // 页面扩展关联字段不回显，linkFields为后台返回的当前关联字段，目前关联字段支持三种，1、单行文本 2、选择框 3、浏览按钮
                    if (isfromTab == '1' || isfromRight == '1') {
                        if (undefined != quickSearch.quicksearchinfo && quickSearch.linkFields) {
                            let quicksearchinfo = quickSearch.quicksearchinfo;
                            let linkFields = quickSearch.linkFields;
                            for (let i = 0; i < quicksearchinfo.length; i++) {
                                for (let j = 0; j < linkFields.length; j++) {
                                    if (quicksearchinfo[i] && quicksearchinfo[i]['fieldid'] == linkFields[j]) {
                                        // 浏览框
                                        if (quicksearchinfo[i]['fieldhtmltype'] == '3') {
                                            quicksearchinfo[i]["replaceDatas"] = [];
                                            quicksearchinfo[i]["value"] = [];
                                            // 单行文本
                                        } else if (quicksearchinfo[i]['fieldhtmltype'] == '1') {
                                            if (quicksearchinfo[i]["options"] != undefined && quicksearchinfo[i]['options'] != '') {
                                                let options = quicksearchinfo[i]["options"];
                                                options.forEach(element => {
                                                    if (element.selected == true) {
                                                        element.selected = false
                                                    }
                                                });

                                            }
                                            quicksearchinfo[i]["value"] = '';
                                            // 选择框
                                        } else if (quicksearchinfo[i]['fieldhtmltype'] == '5') {
                                            quicksearchinfo[i]["value"] = '';
                                        }
                                    }
                                }
                            }
                            quickSearch.quicksearchinfo = quicksearchinfo;
                        }
                    }

                    this.quickSearchFormData = {};
                    this.printEdcUrl = printEdcUrl;
                    if (undefined != quickSearch.quicksearchinfo && _.isArray(quickSearch.quicksearchinfo)) {
                        quickSearch.quicksearchinfo = quickSearch.quicksearchinfo.sort((a, b) => {
                            return a.orderid - b.orderid
                        })
                    }

                    // 解决 由于quicksearchinfo中数据未返回value字段，导致value改变未被正常观察到的问题
                    if (quickSearch.quicksearchinfo != undefined && quickSearch.quicksearchinfo.length > 0) {
                        quickSearch.quicksearchinfo.map((item) => {
                            if (!item.hasOwnProperty('value')) {
                                // 浏览框
                                if (item['fieldhtmltype'] == '3') {
                                    item["value"] = [];
                                    // 单行文本
                                } else if (item['fieldhtmltype'] == '1') {
                                    item["value"] = '';
                                    // 选择框
                                } else if (item['fieldhtmltype'] == '5') {
                                    item["value"] = '';
                                }
                            }
                            return item;
                        })
                    }

                    this.quickSearchData = quickSearch;
                    this.quickSearchDataWithNoChange = JSON.stringify(this.clearDefaultValue(quickSearch.quicksearchinfo));//转换为字符串防止对象修改
                    this.isCharts = isCharts;
                    this.dataBoard = dataBoard;
                    this.initQuickValue();
                    getWaterMarkImg({ customid: this.params.customid }).then((data: any) => {
                        if (data.status == '1') {
                            if (data.isWatermark == 1) {
                                if (data.waterType == "0") {   //文字
                                    this.waterImg = WaterMark.__waterDocumentSvg({ ...data });
                                } else {
                                    this.waterImg = "data:image/png;base64," + data.img; //data:image/png;base64,
                                }
                            } else {
                                this.waterImg = "";
                            }
                        } else {
                            message.error(`${getLabel(127353, '错误')}`);
                        }
                    });
                    //加载列表的代码块
                    const _this = this;
                    setTimeout(function () {
                        _this.toGetJsCodeArea();
                    }, 500)
                } else {
                    message.error(error);
                    throw error;
                }
                let timeCount = () => {
                    let _this = this;
                    let timer = setTimeout(() => {
                        if ((jQuery(".react-resizable-handle") && jQuery(".react-resizable-handle").length > 0) || Number(timer) > 100000) {
                            jQuery(".react-resizable-handle").on("mousedown", _this.addRightMenu)
                            clearTimeout(timer);
                        } else {
                            timeCount();
                        }
                    }, 200)
                }
                timeCount();
            }
        }));

    };


    clearDefaultValue = (datas = []) => {
        const resetToEmpty = (item) => {
            let { fieldhtmltype, fieldtype, value = '' } = item;
            if ((fieldhtmltype == '1' && fieldtype != '1')//数值类型
                || (fieldhtmltype == '5' && fieldtype == '1')//下拉框
                || (fieldhtmltype == '4' && fieldtype == '1') //勾选框
                || (fieldhtmltype == '5' && fieldtype == '2') //多选框
                || (fieldhtmltype == '5' && fieldtype == '3') //单选框
            ) {
                if (fieldhtmltype == '1' && fieldtype != '1') {
                    item.value = '-1';
                } else {
                    item.value = '';
                }
            } else if (fieldhtmltype == '3' && fieldtype == '1') {//人员 ["-5",""]||[]
                if (value[0] == '-5') {//全部 ["0", null]
                    item.value = ["-5", ""];
                } else {
                    item.value = ["0"];
                }
            } else if (fieldhtmltype == '3' && fieldtype == '2') {//创建日期
                item.value = ["0"];
            } else if (item.hasOwnProperty('replaceDatas')) {
                item.replaceDatas = [];
            } else {
                item.value = '';
            }
            return item;
        };
        const res = datas.map((data: any) => {
            if (data.hasOwnProperty('searchGroup')) {
                data.searchGroup = data.searchGroup.map((item: any) => {
                    return resetToEmpty(item);
                })
            } else {
                data = resetToEmpty(data);
            }
            return data;
        });
        return res;
    };
    addRightMenu = () => {
        let flag = true;
        this.rightMenus.forEach(e => {
            if (e.key == 'CleanCol') {
                flag = false;
            }
        })

        if (flag) {
            this.rightMenus.push({
                function: "CleanCol",
                icon: "icon-mode-batch-editing",
                key: "CleanCol",
                name: "初始化列宽",
                quickButton: false

            });
        }

    }

    initQuickValue = () => {
        this.quickSearchData.quicksearchinfo && this.quickSearchData.quicksearchinfo.map((item) => {
            const setItem = (item) => {
                let value: any;
                let { fieldhtmltype, fieldtype } = item;
                if (fieldhtmltype == '1') {
                    if (fieldtype == '1' && item.value) {
                        value = item.value;
                    }
                    if (['2', '3', '4', '5'].indexOf(fieldtype) > -1) {//数值
                        let selectArr = item.options.filter((opt) => opt.selected == true);
                        if (selectArr.length > 0) {
                            value = selectArr[0].key;
                            item.value = value;//暂时在前端改，后期需要后端返回value
                        }
                    }
                } else if (fieldhtmltype == '3') {
                    let isHrm = fieldtype == '1' || ('1' == item.conditiontransition && '17' == fieldtype)
                    if (isHrm || ['2', '19', '290'].indexOf(fieldtype) > -1) {//人力资源和日期等
                        if (item.value) {
                            value = item.value;
                        }
                    } else {
                        if (item.replaceDatas) {
                        value = item.replaceDatas.reduce((pre,current,c,d)=>{return pre ? `${pre},${current.id}` : current.id},'');
                        }
                    }
                } else if ((fieldhtmltype == '5' && ['1', '2', '3'].indexOf(fieldtype) > -1) || (fieldhtmltype == '4' && fieldtype == '1')) {//选择框、勾选框等
                    let selectArr = item.options.filter((opt) => opt.selected == true);
                    if (selectArr.length > 0) {
                        value = selectArr[0].key;
                    }
                }
                return value
            }
            if (item.hasOwnProperty('searchGroup')) {
                item.searchGroup.map(groupItem => {
                    let value = setItem(groupItem);
                    if (value) {
                        _.set(this.quickSearchFormData, groupItem.fieldid, value)
                    }
                })
            } else {
                let value = setItem(item);
                if (value) {
                    _.set(this.quickSearchFormData, item.fieldid, value)
                }
            }
        })
    }

    @action
    getConditionOrAdvanced = (params: any) => {
        if (this.type == 'advanced') {
            this.getAdvancedInfo(params, () => { });

        } else {
            this.getConditionInfo(params, this.afterConditionInit);
        }
    }

    @action
    afterConditionInit = (params: any) => {
        for (let field in params) {
            if (this.condition.form.fieldMap && this.condition.form.fieldMap[field] && this.condition.form.fieldMap[field]['conditionType'] && this.condition.form.fieldMap[field]['conditionType'] == 'SCOPE') {//条件参数传参，scope类型处理
                if (typeof params[field] == 'string') {//如果是字符串
                    params[field] = [params[field].split(',')[0], params[field].split(',')[1]];
                }
            }
        }
        this.params = params;
        this.getConditionParams(params, (dataSource) => {
            let dataSourceParams = {};
            for (let field in dataSource) {
                if (Array.isArray(dataSource[field])) {
                    dataSourceParams[field] = dataSource[field].join(',');
                } else if (typeof dataSource[field] == 'object') {
                    dataSourceParams[field] = dataSource[field].value;
                } else {
                    dataSourceParams[field] = dataSource[field];
                }
                //多部门单独处理
                if (field.startsWith('dbm_con_')) {
                    this.params[field] = dataSourceParams[field];
                }
            }
            if(JSON.stringify(this.copyDataSource) == "{}"){
                this.copyDataSource = dataSourceParams;
            }
            this.copyIsNullField = dataSource;
            let isQuickValue = {};
            let canAdd = 0;
            let { quicksearchinfo = [] } = this.quickSearchData;
            quicksearchinfo.map(item => {
                let isadd = 0;
                for (let key in dataSourceParams) {
                    let fieldid = key.substring(4, key.length)
                    if (fieldid == item.fieldid) {
                        isadd++;
                        // _.set(this.quickSearchFormData, item.fieldid,dataSourceParams[key]);
                    }
                }
                if (isadd == 0) {
                    let { value = '', replaceDatas = [], options = [], conditiontransition = '', fieldtype = '' } = item;
                    if (value != '') {
                        if (conditiontransition == '1' && fieldtype == '17') {//但人力资源单选变多选单独解析
                            let hrmValue = '';
                            if (item.value[1] && item.value[1] != '') {
                                if (item.value[1][0]) {
                                    hrmValue = item.value[1][0];
                                }
                            } else if (item.value[0] && item.value[0] != '') {
                                hrmValue = item.value[0];
                            }
                            isQuickValue[item.fieldid] = hrmValue;
                        } else {
                            isQuickValue[item.fieldid] = item.value;
                        }
                        canAdd++;
                    } else if (replaceDatas != '') {
                        let repalceValues = '';
                        replaceDatas.map(its => {
                            repalceValues += its.id + ",";
                        });
                        repalceValues = repalceValues.substring(0, repalceValues.length - 1);
                        isQuickValue[item.fieldid] = repalceValues;
                        canAdd++;
                    } else if (options != '') {
                        let opValue = '';
                        let isOptions = 0;
                        options.map(opItem => {
                            let { key = '', selected } = opItem;
                            if (selected) {
                                opValue = key + ",";
                                isOptions++;
                                canAdd++;
                            }
                        });
                        if (isOptions > 0) {
                            opValue = opValue.substring(0, opValue.length - 1);
                            isQuickValue[item.fieldid] = opValue;
                        }
                    }
                }
            });
            if (canAdd > 0) {
                isQuickValue = { ...isQuickValue, canIsQuickSearch: '1' }
            }
            let isNewTableSearch = { isNewTableSearch: "1" };
			let linkParams = {};
            //存在页面扩展关联字段，则需要取关联字段的值QC944386
            let linkFields = this.copyDataSource && this.copyDataSource.linkFields || '';
            if (linkFields) {
                linkParams = {
                    [linkFields]: this.copyDataSource[linkFields],
                    linkFields: linkFields
                }
            }
            if (this.isEdit) {
                this.doBatchEdit_datakey();
            } else {
                this.dataKey({ ...this.params, ...this.getConditionValues(), ...dataSourceParams, ...isQuickValue, ...isNewTableSearch,...linkParams });
            }
            //树工具栏相关
            if (params.fromToolBar && params.fromToolBar == '1') {
                delete params.quickSearchValue;
                delete params.datasqlwhere;
                delete this.params.quickSearchValue;
                delete this.params.datasqlwhere;
            }
            if (!this.isShowCondition) {
                this.condition.update({ visible: false });
            }
        });
    }


    @action
    getTemplate = (params: any, first: boolean = false, callback?: (bool?: boolean) => void) => {
        API.getTemplates({
            ...params,
            type: (this.type == 'advanced' ? '1' : '2')//显示普通查询的模板或高级查询的
        }).then(({ error, status, templates = [] as any[] }) => {
            if (status == '1') {
                if (this.type == 'advanced') {
                    this.advanced.templates = templates;
                } else {
                    this.condition.templates = templates;
                }
                if (first) {
                    let selected = templates.filter(t => t.selected);
                    if (selected.length > 0) {
                        this.changeTemplate(selected[0].key, () => {
                            if (this.type == "base") {
                                callback && callback(true);
                            }
                        });
                    } else {
                        callback && callback(false);
                    }
                }

            } else {
                message.error(error)
                throw error;
            }
        })
    }
    @action
    changeTemplate = (templateid: string, callback?: () => void) => {
        this.templateid = templateid;
        if (!templateid) {
            if (this.type == 'advanced') {
                this.advanced.form = new WeaForm();
            } else {
                this.condition.form = new WeaForm();
            }
            this.getConditionOrAdvanced(this.params);
            return;
        }

        API.getTemplateInfo({ ...this.params, templateid }).then(({ status, error, conditionInfo, dataSource, checkAdvanedData }) => {
            this.isTempSearch = "1";
            if (status == '1') {
                this.checkAdvanedData = checkAdvanedData;
                //qc808406如果模板中查询条件全部取消勾选，模板不生效
                if (conditionInfo[0].items && conditionInfo[0].items.length <= 0) {
                    this.getConditionOrAdvanced(this.params);
                } else {
                    const _timer = (advanced) => {
                        if (advanced.form.isFormInit) {
                            advanced.updateField(dataSource, true);
                            if (callback) {
                                callback();
                            } else {
                                this.type == "base" && this.refresh();
                            }
                        } else {
                            setTimeout(() => {
                                if (advanced.form.isFormInit) {
                                    advanced.updateField(dataSource, true);
                                    if (callback) {
                                        callback();
                                    } else {
                                        this.type == "base" && this.refresh();
                                    }
                                } else {
                                    _timer(advanced);
                                }
                            }, 200);
                        }
                    }
                    if (this.type == 'advanced') {
                        this.advanced.form = new WeaForm();
                        this.advancedInfo = conditionInfo;
                        this.advanced.form.initFormFields(conditionInfo);
                        this.isInit = true;
                        _timer(this.advanced);

                    } else {
                        this.condition.form = new WeaForm();
                        this.conditionInfo = conditionInfo;
                        this.condition.form.initFormFields(conditionInfo);
                        _timer(this.condition);
                    }
                    if (!this.isShowCondition) {
                        this.condition.update({ visible: false });
                    }
                }

                // this.refresh();
            } else {
                message.error(error)
                throw error;
            }
        })
    }
    @action
    reloadSearch = (params: any, card?: CardStore) => {
        this.clear();
        if (card) {
            this.card = card;
        }
        this.init(params);
    }
    @action
    getConditionParams = (params: any, callback?: (params?: any) => void) => {
        API.getConditionParams({ ...params, type: this.type }).then(({ error, status, dataSource }) => {
            if (status == '1') {
                _.keys(params).forEach(item => {//去除掉未勾选查询条件的参数字段
                    if (item.startsWith('con_') && !dataSource[item]) {
                        delete this.params[item];
                    }
                });
                let newDataSource = { ...toJS(this.params), ...dataSource };
                let expendNewDataSource = { ...toJS(this.params), ...dataSource };
                // 如果是页面扩展卡片页面的关联字段，则条件不回显到高级查询
                let linkFields = expendNewDataSource.linkFields;
                if (linkFields && (expendNewDataSource.isfromTab == '1' || expendNewDataSource.isfromRight == '1')) {
                    for (let field in expendNewDataSource) {
                        for (let i = 0; i < linkFields.length; i++) {
                            if (field == linkFields[i]) {
                                delete expendNewDataSource[field];
                            }
                        }

                    }
                }

                if (this.type == 'advanced') {
                    this.advanced.updateField(expendNewDataSource);
                } else {
                    this.condition.updateField(expendNewDataSource);
                }
                callback && callback(newDataSource)
            } else {
                message.error(error)
                throw error;
            }
        })
    }
    @action
    getAdvancedInfo = (params: any, callback?) => {
        API.getAdvancedInfo(params).then(({ error, status, ...props }) => {
            if (status == '1') {
                let { checkAdvanedData } = props;
                this.checkAdvanedData = checkAdvanedData;
                let { dataSource = {} } = props;
                this.advanced.form = new WeaForm();
                this.advancedInfo = props.advancedInfo;
                this.advanced.form.initFormFields(this.advancedInfo);
                if (!_.isEmpty(dataSource)) {
                    this.advanced.updateField(dataSource);
                }
                this.isInit = true;
                callback && callback(params);
            } else {
                message.error(error);
                throw error;
            }
        });
    }
    @action
    getConditionInfo = (params: any, callback?) => {
        API.getConditionInfo(params).then(({ error, status, ...props }) => {
            if (status == '1') {
                if (params.customid == this.params.customid) {
                    this.update(props);
                    this.condition.form.initFormFields(props.conditionInfo);
                    this.condition.form.isFormInit = true;
                    callback && callback(params);
                }
            } else {
                message.error(error)
                throw error;
            }
        });
    }

    @action
    toGetJsCodeArea = (renderOrder = 'isAfter', callback?) => {
        if (renderOrder == 'isBefore') {
            modeList.dataLoadAfterCB = null;//预加载回调函数，清理函数代码缓存。
        }
        const params = { customId: this.params.customid, renderOrder }
        API.getJsCodeArea(params).then(({ status, error, scriptStr }) => {
            if (status == '1') {
                try {
                    if (renderOrder == 'isBefore') {
                        const $div = '<div id="custompageCodeAreaBefore">' + scriptStr + '</div>';
                        jQuery('#container').append($div);
                        _.isFunction(callback) && callback();
                    } else {
                        jQuery("#custompageCodeArea").html("").append(scriptStr);
                    }
                } catch (e) {
                    console && console.log("加载查询列表代码块异常！css 部分请用：<style type=\"text/css\"></style>; js部请用：<script type=\"text/javascript\"></script>包裹")
                }
            } else {
                message.error(`${getLabel(127353, "错误")} :${error}`);
            }
        })
    }
    @action
    changeDetailPageSize = (current, pagesize) => {
        this.searchTree = {
            current: current == 0 ? 1 : current,
            pagesize: pagesize
        };
        this.pagesizetree = pagesize;
        if (current == 0) {
            return
        }
		let linkParams = {};
        //存在页面扩展关联字段，则需要取关联字段的值QC944386
        let linkFields = this.copyDataSource && this.copyDataSource.linkFields || '';
        if (linkFields) {
            linkParams = {
                [linkFields]: this.copyDataSource[linkFields],
                linkFields: linkFields
            }
        }
        let params = Object.keys(this.getConditionValues()).length == 0 ? { ...toJS(this.quickSearchFormData), isQuickSearch: 1 } : this.getConditionValues();
        this.dataKey({ current: this.searchTree.current, pagesize: pagesize, ...params,...linkParams });
    }
    @action
    nextDetailDatas = (pagination) => {
        let current = pagination;
        this.searchTree = {
            ...this.searchTree,
            current: current
        };
        this.tableData = {
            total: 0,
            Data: [],
        };
        if (current == 0) {
            this.searchTree.current = 1;
            return
        }
        let params = Object.keys(this.getConditionValues()).length == 0 ? { ...toJS(this.quickSearchFormData), isQuickSearch: 1 } : this.getConditionValues();
        this.dataKey({ current: current, pagesize: this.pagesizetree, ...params });
    }

    @action
    imgPageChaneg = (current, pageSize) => {
        this.newTable.datas = [];
        this.imgPageRefresh = true;
        if (pageSize) {
            setTablePageSize({
                pageSize,
                dataKey: this.sessionKey
            }).then(action(({ status, errorCode, error, datas }) => {
                if (status == '1') {
                    this.newTable.current = 1;
                    this.newTable.getDatas(this.sessionKey, this.newTable.current, this.newTable.pageSize, {}, this.addScroll);
                } else {
                    message.error(`[${getLabel(127353, '错误') + errorCode}]:${error}`);
                }
            }));
        } else {
            this.newTable.current = current;
            this.newTable.getDatas(this.sessionKey, this.newTable.current, this.newTable.pageSize, {}, this.addScroll);
        }
    }

    @action
    dataKey = (params: any) => {
        //处理选择框的key
        let keys = _.keys(params);
        for (let i = 0; i < keys.length; i++) {
            let key = keys[i];
            if (key.indexOf(',') > 0) {
                params[key.split(',')[0]] = params[key];
            }
        }
        // @ts-ignore
        let windowWidth = document.documentElement.clientWidth;
        this.loading = true;
        if (params && params['isQuickSearch']) {
            if (params && params['isfromTab'] != '1') {
                _.forOwn(this.params, (value, key) => {
                    if (key.startsWith('con_')) {
                        delete this.params[key]
                    }
                })
            }
        }
        if (this.displayType === SearchDisplayType.ImgType) {
            this.imgSelectValue = "";
            this.searchImg.loading = true;
            params = { ...params, current: this.newTable.current, pagesize: this.newTable.pageSize }
            if (!this.imgPageRefresh) {
                this.selectRowKeyAll(true);
            } else {
                this.imgPageRefresh = false;
            }
        }
        /**z纵向列表清空数据， */
        if (this.displayType === SearchDisplayType.VerticalType) {
            this.selectRowkeys = [];
            this.verticalListStore.clear();
            this.verticalListStore.update({ loading: true })
        }
        if (this.top.selectedKey !== 'all') {
            params.groupValue = this.top.selectedKey;
        }
        //分组列表-分页
        let pageInfo = {}
        if (this.displayType && this.displayType == 'treeType') {
            pageInfo['current'] = this.searchTree.current;
            pageInfo['pagesize'] = this.searchTree.pagesize;
        }
        //存在页面扩展关联字段，则需要取关联字段的值QC944386
        let linkParams = {};
        let linkFields = this.copyDataSource && this.copyDataSource.linkFields || '';
        if (linkFields) {
            linkParams = {
                [linkFields]: this.copyDataSource[linkFields],
                linkFields: linkFields
            }
        }
        //处理选择框的key
        const requireTimes = this.requireTimesdata;
        this.update({ requireTimesdata: requireTimes + 1 });
        this.reloadParams = params;
        const tempParams = { ...this.params, ...params, displayType: this.displayType, ...pageInfo, isTempSearch: this.isTempSearch, windowWidth: windowWidth,...linkParams };
        //统计和分组统计单独处理
        this.getCountData(tempParams);
        this.getGroupData(tempParams);
        API.dataKey(tempParams).then(action(({ error, status, datas, countDisplayPosition, buttonBody, treeFieldStr, editableColumns, singleKeyField, treemap, enableTreeList, isTreeSearch, treeposition, windowTitle, changeDataTime, isChexkAdvanedDate, treeDataWidth, mergeInfos, mergeFields }) => {
            const requireTimesNow = this.requireTimesdata;
            if (requireTimesNow == requireTimes + 1) {
                if (status == '1') {
                    this.isTempSearch = "";
                    this.sessionKey = datas;
                    this.mergeInfos = mergeInfos;
                    this.mergeFields = mergeFields;
                    // const tempKey = datas;
                    this.treeDataWidth = treeDataWidth;
                    this.isTree = false;
                    this.checkAdvanedData = isChexkAdvanedDate;
                    this.countDisplayPosition = String(countDisplayPosition);
                    try {
                        jQuery("#cubelistCodeArea").html("");
                        jQuery("#cubelistCodeArea").append(`<script type="text/javascript">${buttonBody} </script>`);

                    } catch (e) {
                        console && console.log(getLabel('522704', '自定义按钮代码块异常!'))
                    }
                    this.listEditStore.editableColumns = editableColumns;
                    this.enableTreeList = enableTreeList;
                    this.changeDataTime = changeDataTime;
                    this.printWindowTitle = windowTitle;
                    if (this.params.menuIds) {//门户工具栏的点击,不需要改变页面title
                        this.windowTitle = windowTitle;
                    }
                    this.isTreeSearch = isTreeSearch;
                    if (treeposition != "" && isTreeSearch == "1" && enableTreeList == "y" && this.isTreeType == '') {
                        this.isTree = true;
                    }
                    if (this.displayType === SearchDisplayType.Excel) {
                        this.excelStore.getDatas(datas);
                    } else if (this.displayType == SearchDisplayType.TreeType && this.isTree) {
                        //QC:723922
                        if (!params || (params.isNewTableSearch && params.isNewTableSearch == 1)) {
                            this.selectedRowKeys = [];
                            this.treeKey = [];
                        }
                        this.isExpTree = '1';
                        const { total = 0, treecolumns = [] } = treemap as any;
                        let { treedatas } = treemap;
                        this.addScrollForTree(treedatas);
                        if (this.doRealAction) {//数据筛选
                            this.checkLoading = true;

                            this.tempTabledatas = JSON.parse(JSON.stringify(treedatas));
                            this.tempselectedRowKeys = this.selectedRowKeys;
                            let removeSelct = [] as any[];
                            this.checkBtn = "expandid_" + this.oldMenueKey;
                            treedatas.map((item) => {
                                if (item[this.checkBtn] == "true") {
                                    item.randomFieldCk = "false";
                                    removeSelct.push(item['key'] || item['id'] || item['randomFieldId']);
                                }
                                if (item.sublist) {
                                    item.sublist = this.dealSubList(item.sublist, removeSelct);
                                }
                            })
                            let rowkeys = _.difference(this.tempselectedRowKeys, removeSelct);
                            this.filterSelectRows = removeSelct;
                            this.tableData.Data = JSON.parse(JSON.stringify(datas));
                            this.selectedRowKeys = rowkeys;
                            setTimeout(() => {
                                this.checkLoading = false;
                            }, 1000);
                        }
                        if (modeList.dataLoadAfterCB && typeof modeList.dataLoadAfterCB == 'function') {
                            // @ts-ignore
                            treedatas = modeList.dataLoadAfterCB(toJS(treedatas), 'treeType');
                        }
                        this.tableData = {
                            total: total,
                            Data: treedatas
                        };
                        let treePercent = 0;
                        treecolumns.map(col => {
                            treePercent += parseFloat(col.width.replace('%', ''))
                        });
                        if (this.searchTree.current == 0) {
                            this.searchTree.current = 1;
                        }
                        this.treePercent = treePercent;
                        this.treecolumns = treecolumns;
                        this.changeSearch = '1';
                        if (countDisplayPosition === 2) { // 针对分组列表，需在top加载后再render一次，加载右上角展示的“统计项”
                            setTimeout(() => {
                                this.countData = toJS(this.countData);
                            }, 100);
                        }
                    } else {
                        // if(!this.doRealAction){
                        //     this.clearTable();
                        // }else{
                        this.countReturn = 0;
                        this.newTable = new TableStore(
                            {
                                dataHandle: (datas) => {
                                    this.rightLayoutWidth = '0%';
                                    if (this.rowClick['5']) {//如果存在列表小卡片，处理下分页函数
                                        this._$('tr[littlecard]').remove();
                                    }
                                    this.countReturn++;// table请求datas接口后会多次执行dataHandle方法，用来标记次数
                                    if (this.doRealAction) {//数据筛选
                                        this.checkLoading = true;
                                        if (this.countReturn == 2) {
                                            if (modeList.dataLoadAfterCB && typeof modeList.dataLoadAfterCB == 'function') {
                                                // @ts-ignore
                                                datas = modeList.dataLoadAfterCB(toJS(datas), 'normal');
                                            }
                                        }
                                        this.tempTabledatas = JSON.parse(JSON.stringify(datas));
                                        const isImgSearch = this.displayType == SearchDisplayType.ImgType;
                                        this.tempselectedRowKeys = isImgSearch ? this.selectRowkeys : this.newTable.selectedRowKeys
                                        let removeSelct = [] as any[];
                                        let expandBtn = "expandid_" + this.oldMenueKey + "span";
                                        if (this.displayType == SearchDisplayType.TreeType) {
                                            expandBtn = "expandid_" + this.oldMenueKey;
                                        }
                                        this.checkBtn = expandBtn;
                                        datas.map((item) => {
                                            if (item[this.checkBtn] == "true") {
                                                item.randomFieldCk = "false";
                                                if(isImgSearch){
                                                    const imgId = item.randomFieldId ? (item.randomFieldSubKeyd_id != undefined ? `${item.randomFieldId}_${item.randomFieldSubKeyd_id}` : item.randomFieldId) : "";
                                                    removeSelct.push(imgId);
                                                }else{
                                                    removeSelct.push(item['id']);
                                                }
                                            }
                                        })
                                        let rowkeys = _.difference(this.tempselectedRowKeys, removeSelct);
                                        this.filterSelectRows = removeSelct;
                                        this.newTable.selectedRowKeys = rowkeys;
                                        if (isImgSearch) {
                                            this.selectRowkeys = rowkeys;
                                            this.setImgSelectValue(_.uniq(rowkeys.map(d => d.split('_')[0])).join(','));
                                        }
                                        // this.newTable.selectedRowKeysAllPages = rowkeys;
                                        setTimeout(() => {
                                            this.checkLoading = false;
                                        }, 1000);
                                    } else {
                                        if (this.countReturn == 2) {
                                            if (modeList.dataLoadAfterCB && typeof modeList.dataLoadAfterCB == 'function') {
                                                // @ts-ignore
                                                datas = modeList.dataLoadAfterCB(toJS(datas), 'normal');
                                            }


                                        }
                                    }
                                    if (this.displayType === SearchDisplayType.ImgType) {
                                        this.searchImg.loading = false;
                                    }
                                    if (this.countReturn == 2 && this.displayType === SearchDisplayType.VerticalType && countDisplayPosition === 2) {
                                        // 针对分组列表，需在top加载后再render一次，加载右上角展示的“统计项”
                                        setTimeout(() => {
                                            this.countData = toJS(this.countData);
                                        }, 100);
                                    }
                                    if (this.countReturn == 2) {
                                        this.countReturn = 0;
                                    }
                                    return datas;
                                },
                            }
                        );
                        // }
                        //纵向列表pagesize =
                        if (this.displayType == SearchDisplayType.VerticalType) {
                            const { current, pageSize, newDataBacks } = this.verticalListStore;
                            this.newTable.getDatas(datas, current, pageSize, {}, newDataBacks);
                        } else {
                            this.newTable.getDatas(datas, this.newTable.current, this.newTable.pageSize, {}, this.addScroll);
                        }
                        this.changeSearch = '0';
                    }

                    this.treeFieldStr = treeFieldStr;
                    if (singleKeyField) {
                    }

                } else {
                    message.error(error)
                    throw error;
                }
                if (!this.condition.isInit) {
                    this.condition.isInit = true;
                    if (this.isShowCondition) {
                        this.condition.update({ visible: true })
                    } else {
                        this.condition.update({ visible: false })
                    }
                }
                this.isInit = true;
                if (this.isInnerTab) {
                    const changeLoadingState = (getParent() as any).changeLoadingState;
                    changeLoadingState && changeLoadingState(false);
                } else {
                    this.loading = false;
                }
            }
        }));
    }
    @action deleteData = (params: any, callback: (data: any) => void) => {
        API.deleteData(params).then(({ status, error, ...data }) => {
            if (status == '1') {
                this.isDelShow = false;
                callback(data);
                if (this.params.isRefreshTree == '1') { //树的 删除的时候检查是否刷新左侧树
                    (window as any).refreshTree(this.params.customTreeDataId);
                }
            } else {
                message.error(error)
                throw error;
            }
        })
    }

    /**
     * 用于分组列表添加无数据时的横向滚动条
     */
    addScrollForTree = (treedatas = []) => {
        var scrollText = this._$('.cube-list-wrapper .cube-list-table .ant-table-header').attr("style");
        if (scrollText) {
            this._$('.e8operate').hover(
                function (e) {
                    // jQuery("table tr").hover(function(){
                    //     var lh = jQuery(this).index();//这个前面得到的是tr的序号，从0开始，要得到第几行，+1即可
                    //     jQuery(jQuery('.hoverDiv')[lh]).css("display","block");
                    // })
                    // jQuery("table tr").mouseover(function(){
                    //     setTimeout(()=>{
                    //         var lh = jQuery(this).index();//这个前面得到的是tr的序号，从0开始，要得到第几行，+1即可
                    //         jQuery(jQuery('.hoverDiv')[lh]).css("display","none");
                    //        } ,100)
                    // })
                }
            )
            if (treedatas.length < 1) {//若分组列表无数据
                if (!!window['ActiveXObject'] || "ActiveXObject" in window) {
                    this._$('.ant-table-body').css('overflow-x', 'hidden').css('overflow-y', 'hidden');
                }
                var styleCss = scrollText + "margin-bottom: 0px !important;padding-bottom:0px !important;";
                this._$('.cube-list-wrapper .cube-list-table .ant-table-header').css('cssText', styleCss).css('overflow-x', 'scroll');
            } else {
                this._$('.cube-list-wrapper .cube-list-table .ant-table-header').css('cssText', '')
                this._$('.cube-list-wrapper .cube-list-table .ant-table-body').css('overflow-x', 'auto').css('overflow-y', 'auto');
                this._$('.cube-list-wrapper .cube-list-table .ant-table-header').css('overflow-x', 'hidden')
            }
        } else {
            const _this = this;
            setTimeout(() => {
                _this.addScrollForTree(treedatas);
            }, 200);
        }
    }

    /**
     * 用于添加无数据时的横向滚动条(除分组列表)
     */
    addScroll = () => {
        var scrollText = this._$('.cube-list-wrapper .cube-list-table .ant-table-header').attr("style");
        if (scrollText && !(this.displayType === SearchDisplayType.TreeType && this.isTree)) {
            if (this.newTable.datas.length < 1 && !this.newTable.isSts) {	//若table无数据，将标题栏设为可滚动
                if (!!window.ActiveXObject || "ActiveXObject" in window) {
                    this._$('.ant-table-body').css('overflow-x', 'hidden').css('overflow-y', 'hidden');
                }
                var styleCss = scrollText + ";margin-bottom: 0px !important;padding-bottom:0px !important";
                this._$('.cube-list-wrapper .cube-list-table .ant-table-header').css('cssText', styleCss);
                this._$('.cube-list-wrapper .cube-list-table .ant-table-header').css('overflow-x', 'scroll');
            } else {
                this._$('.cube-list-wrapper .cube-list-table .ant-table-header').css('cssText', '')
                this._$('.cube-list-wrapper .cube-list-table .ant-table-body').css('overflow-x', 'auto').css('overflow-y', 'auto');
                this._$('.cube-list-wrapper .cube-list-table .ant-table-header').css('overflow', 'hidden')
            }
        } else {
            const _this = this;
            setTimeout(() => {
                _this.addScroll();
            }, 200);
        }
    }

    getConditionValues = () => {
        let values;
        if (this.type == 'advanced') {
            values = this.advanced.form.getFormParams();
        } else {
            values = this.condition.form.getFormParams();
            values = { ...this.advanced.form.getFormParams(), ...values }
        }
        let newValues = {};
        _.forEach(values, (value, key) => {
            if (this.params[key] && value == '') {
                newValues[key] = value;
            }
            if (_.compact(`${value}`.split(',')).length > 0) {
                newValues[key] = value;
            }
        })
        return newValues;
    }
    @action
    refresh = (isQuickSearch?: boolean,isAdvancedSearch?: boolean) => {
        this.loading = true;
        if (this.isInnerTab) {
            const changeLoadingState = (getParent() as any).changeLoadingState;
            changeLoadingState && changeLoadingState(true);

            //判断是否含有条件hidetop=1，如果有则隐藏Top栏
            if (this.params.hidetop) {
                let hidetop = this.params.hidetop;
                this.isInnerTab = hidetop && (hidetop | 0) === 1;
            }
        } else {
            this.loading = true;
        }
        this.advanced.visible = false;
        if (!this.isShowCondition) {
            this.condition.visible = false;
        }
        // if (!isQuickSearch) {
        //     this.quickSearchValue = '';
        // }
        let isQuickSearch1 = false;
        const quickSearchFormData = toJS(this.quickSearchFormData);
        if (quickSearchFormData && JSON.stringify(quickSearchFormData) !== '{}') {
            isQuickSearch1 = true;
        }
        this.searchTree.current = 1;
        
        let advancedSearchParam = {};
        let linkParams = {};
        if(isAdvancedSearch){
            //如果是高级搜索，不能走完全匹配
            advancedSearchParam = {
                "isfromTab" : '0',
                "isfromRight" : '0'
            }
        }
        //存在页面扩展关联字段，则需要取关联字段的值QC944386
        let linkFields = this.copyDataSource && this.copyDataSource.linkFields || '';
        if (linkFields) {
            linkParams = {
                [linkFields]: this.copyDataSource[linkFields],
                linkFields: linkFields
            }
        }
        
        if (this.isEdit) {
            this.doBatchEdit_datakey();
            return;
        }
        this.dataKey({
            ...this.params,
            ...this.customparms,
            //...this.copyDataSource,//这个条件范围应该是最优
            ...isQuickSearch ? { quickSearchValue: this.quickSearchValue } : {},
            ...this.getConditionValues(),
            ...linkParams,
            groupValue: this.top.selectedKey,
            ...this.quickConditions,
            ...isQuickSearch1 ? { isQuickSearch: "1", ...this.quickSearchFormData } : {},
            ...advancedSearchParam,
        });
        if (this.type == 'advanced') {
            this.type = 'base';
            this.getConditionInfo(this.params, () => {
                this.condition.form.updateFields(this.advanced.form.getFormDatas(), false);
            });
            this.getTemplate(this.params);
        } else {
            const keySearchFieldKeys = this.keySearchFields.slice();
            if (isQuickSearch && keySearchFieldKeys.length == 1) {
                if (this.condition.form.isFormInit) {
                    if (this.keyFieldidInfo.fieldid && this.keyFieldidInfo.type == '1'
                        && (this.keyFieldidInfo.htmltype == '1' || this.keyFieldidInfo.htmltype == '2')) {
                        this.condition.updateField({ ["con_" + this.keyFieldidInfo.fieldid]: this.quickSearchValue });
                    }
                }
            }
        }
        // this.searchTree = {
        //     current: 1,
        //     pagesize: 10
        // }
        this.selectedRowKeys = [];
        // this.selectRowkeys = [];
    }

    @action
    reload = () => {
        this.newTable.getDatas('', this.newTable.current, this.newTable.pageSize, {}, this.addScroll);
        this.reloadTabsAndCounts();  //更新下基础数据，tabs，
        this.selectRowkeys = [];

    }
    saveTemplate = () => {
        this.template.saveTemplate(this);
    }
    managerTemplate = () => {
        this.template.managerTemplate(this);
    }
    onQuickConditionChange = (params: any) => {
        this.update({ quickConditions: { ...this.quickConditions, ...params } });
        this.refresh();
        return this;
    }
    setTreeValueId = (treeValueId) => {
        this.treeValueId = treeValueId;
    }
    checkSeleted = () => {
        let selectedRows = this.treeValueId == "" ? window._xtable_CheckedCheckboxId() : this.treeValueId;
        if (this.displayType == SearchDisplayType.ImgType) {
            selectedRows = this.imgSelectValue
        }
        if (this.displayType == SearchDisplayType.VerticalType) {
            selectedRows = this.verticalListStore.selectValue;
        }
        if (this.displayType == SearchDisplayType.TreeType && this.treeKey && this.isTreeType != '1') {
            selectedRows = this.treeKey;
            this.treeValueId = _.uniq(this.treeKey.map(d => d.split('_')[0])).join(",");
        }
        if (selectedRows.length < 1) {
            message.error(getLabel(20149, '请至少选择一条记录。'));
            return false;
        }
        return true;
    }
    submitData = () => {
        this.refresh();
    }
    doBatchAdd = () => {
        this.batchAddStore.customid = this.customId;
        this.batchAddStore.params = this.params;
        this.batchAddStore.init();
        WeaTools.loadCss();
        this.batchAddStore.visible = true;
        WeaTools.loadCss();
        this.batchAddStore.isfrontmultlang = this.isfrontmultlang;
    }

    @action
    doBatchEdit = () => {
        this.loading = true;
        this.editTableStore.isDataLoaded = false;
        API.getSearchColumnInfo({ customid: this.customId }).then(action(({ error, status, dataList, optionsMap, browserMap, editFieldCount, bathEditSaveQuickButton }) => {
            if (status == '1') {
                if (editFieldCount == '0') {
                    message.warn('查询列表字段定义中批量修改没有勾选，请联系管理员处理！');
                    this.loading = false;
                    return;
                }
                this.batchTempRightMenus = this.rightMenus;
                this.rightMenus = [
                    bathEditSaveQuickButton,
                ];
                this.batchTempRightMenus.forEach(item => {
                    if (item.function == 'submitData' && item.icon == 'icon-coms-search') {
                        this.rightMenus.push(
                            {
                                'function': 'submitData',
                                'icon': 'icon-coms-search',
                                'key': 'submitData',
                                // 'name': getLabel(192, '搜索'),
                                'name': item.name,
                                'quickButton': item.quickButton
                            }
                        );
                    }
                })
                this.rightMenus.push(
                    {
                        'function': 'doBack',
                        'icon': 'icon-coms-go-back',
                        'key': 'doBack',
                        'name': getLabel(1290, '返回'),
                        'quickButton': false
                    }
                );

                if (this.displayType === SearchDisplayType.Excel) {
                    this.isEdit = true;
                    let parm: any = {
                        urlMap: this.urlMap,
                        modeId: this.modeId,
                        formId: this.formId,
                        confirmMap: this.confirmMap
                    }
                    this.datalist = dataList;
                    this.doBatchEdit_datakey((dataKey) => {
                        this.excelStore.batchEdit(dataKey, dataList, browserMap, this.batchTempRightMenus, parm);
                    });
                } else {
                    this.isEdit = true;
                    this.editTableStore.customid = this.params.customid;
                    this.datalist = dataList;
                    //let columns1 = this.dealmergecolumn(dataList);
                    this.editTableStore.initTableForm([], getColumns(dataList, optionsMap, browserMap, this.isfrontmultlang, this.editTableStore, this.buildsqlkey(dataList)));
                    this.mergeTempColumns = this.editTableStore.columns;
                    this.editPagination.current = 1;
                    this.editPagination.pageSize = this.newTable.pageSize;
                    this.editPagination.total = this.newTable.count;
                    this.editPagination.onChange = (current: number, pageSize: number) => {
                        this.editPagination.current = current;
                        this.editPagination.pageSize = pageSize || this.editPagination.pageSize;
                        this.getEditDatas();
                    }
                    this.editPagination.onShowSizeChange = (current: number, pageSize: number) => {
                        this.editPagination.current = current;
                        this.editPagination.pageSize = pageSize || this.editPagination.pageSize;
                        setTablePageSize({
                            pageSize,
                            dataKey: this.sessionKey
                        }).then(action(({ status, errorCode, error, datas }) => {
                            if (status == '1') {
                                this.getEditDatas();
                            } else {
                                message.error(`[${getLabel(127353, '错误') + errorCode}]:${error}`);
                            }
                        }));
                    }
                    this.doBatchEdit_datakey();
                }
            } else {
                message.error(error);
                throw error;
            }
            this.loading = false;
        }));
    }

    dealmergecolumn = (columns) => {
        const mergeFields = this.mergeFields ? this.mergeFields : '';
        let columns1: any = [];
        let columns2: any = [];//已经处理的列
        for (let n = 0; n < columns.length; n++) {
            let dataindex = columns[n].key;
            const fieldhtmltype = columns[n].fieldhtmltype;
            const type = columns[n].fieldtype;
            if (columns[n].fieldid && (columns[n].fieldid == '-2' || columns[n].fieldid == '-4' || columns[n].fieldid == '-5') || columns[n].fieldid == '-7') {
                dataindex = dataindex.replace('span', '');
            }
            //浮点数 金额转换 金额千分位 多行文本 特殊字段的key加了span
            if ((fieldhtmltype == '1' && (type == '3' || type == '4' || type == '5')) || (fieldhtmltype == '2' && type == '1') || (fieldhtmltype == '7')) {
                dataindex = dataindex.replace('span', '');
            }
            if (mergeFields.indexOf(dataindex) < 0) {//如果不是合并列
                columns1.push(columns[n]);
            } else {//是合并列
                if (columns2.indexOf(dataindex) < 0) {
                    let column = this.getColumn(columns, dataindex, columns2);
                    columns1.push(column);
                    //columns2.push(dataindex)
                }
            }
        }
        return columns1;
    }

    getColumn(columns, dataindex, columns2) {
        const mergeInfos = this.mergeInfos;
        for (let i = 0; i < mergeInfos.length; i++) {
            if (mergeInfos[i].fields.indexOf(dataindex) > -1) {
                for (let m = 0; m < mergeInfos[i].fields.length; m++) {
                    columns2.push(mergeInfos[i].fields[m]);
                }
                let mergecolumn: any = {};
                mergecolumn.title = mergeInfos[i].mergename;
                mergecolumn.className = "column-text-center";
                mergecolumn.display = "true";
                let fieldcount = parseInt(mergeInfos[i].fields.length);
                mergecolumn.width = 100 * fieldcount;
                mergecolumn.children = this.getchildren(mergeInfos[i], columns);
                return mergecolumn;
            }

        }

    }

    getchildren(mergeInfo, columns) {
        let children = mergeInfo.children;
        let childrens: any = [];
        if (children) {
            for (let j = 0; j < children.length; j++) {
                let childreninfo: any = {}
                if (children[j].fieldname) {
                    let fieldname = children[j].fieldname;
                    for (let i = 0; i < columns.length; i++) {
                        let key = columns[i].key;
                        const fieldhtmltype = columns[i].fieldhtmltype;
                        const type = columns[i].fieldtype;
                        if (columns[i].fieldid && (columns[i].fieldid == '-2' || columns[i].fieldid == '-4' || columns[i].fieldid == '-5') || columns[i].fieldid == '-7') {
                            key = key.replace('span', '');
                        }
                        //浮点数 金额转换 金额千分位 多行文本 特殊字段的key加了span
                        if ((fieldhtmltype == '1' && (type == '3' || type == '4' || type == '5')) || (fieldhtmltype == '2' && type == '1') || (fieldhtmltype == '7')) {
                            key = key.replace('span', '');
                        }
                        if (fieldname == key) {
                            childreninfo = columns[i];
                            break;
                        }
                    }
                } else {
                    childreninfo.title = children[j].mergename;
                    childreninfo.className = "column-text-center";
                    childreninfo.display = "true";
                    childreninfo.width = "100";
                    childreninfo.children = this.getchildren(children[j], columns)
                }
                childrens.push(childreninfo);
            }

        }
        return childrens;
    }

    buildsqlkey = (dataList) => {
        let sqlNeedKeytemp: any = { randomkey: new Date().getTime() };
        dataList.map(item => {
            _.set(sqlNeedKeytemp, item.fieldname, item.sqlNeedFieldKey)
        });
        this.sqlNeedKey = sqlNeedKeytemp;
        return sqlNeedKeytemp;
    }

    getSqlNeedFieldKey = (item, index, columns, tableStore?) => {
        const currenttime = new Date().getTime();
        const datalisttemp = this.datalist;
        _.forEach(this.sqlNeedKey, function (value, fieldids) {
            const fields: any = { currenttime };
            _.forEach(value, function (value1, sql) {
                let keytemp = columns.key;
                let value1temp = value1;
                if (_.parseInt(sql) % 2 === 0) {//主表字段
                    if (keytemp.indexOf("span") != -1) {
                        keytemp = columns.key.replace("span", "");
                        //fieldids=fieldids+"span";
                        value1temp = value1temp + "span";
                    }
                    if (keytemp === value1) {
                        const oldbrowserProps = tableStore.form.$('tableForm').$(item.randomFieldId + "_" + item.randomFieldSubKeyd_id).$(fieldids).browserProps || {};
                        _.set(fields, `${value1}_${currenttime}`, item[value1temp]);
                        _.set(fields, 'field' + columns.fieldid, item[value1temp]);
                        tableStore.form.$('tableForm').$(item.randomFieldId + "_" + item.randomFieldSubKeyd_id).$(fieldids).browserProps = {
                            dataParams: { ...oldbrowserProps.dataParams, ...fields },
                            conditionDataParams: { ...oldbrowserProps.conditionDataParams, ...fields },
                            completeParams: { ...oldbrowserProps.completeParams, ...fields },
                        }

                    }
                } else {
                    var valuetemp = "d_" + value1;
                    if (keytemp.indexOf("span") != -1) {
                        keytemp = columns.key.replace("span", "");
                        //fieldids = fieldids+"span";
                        value1temp = value1temp + "span";
                    }
                    if (keytemp === valuetemp) {
                        datalisttemp.map(itemtemp => {
                            if (itemtemp.fieldname === valuetemp) {
                                const oldbrowserProps = tableStore.form.$('tableForm').$(item.randomFieldId + "_" + item.randomFieldSubKeyd_id).$(fieldids).browserProps || {};
                                _.set(fields, `${itemtemp.detailtable + "_" + value1}_${currenttime}`, item[valuetemp]);
                                _.set(fields, 'field' + columns.fieldid, item[value1temp]);
                                tableStore.form.$('tableForm').$(item.randomFieldId + "_" + item.randomFieldSubKeyd_id).$(fieldids).browserProps = {
                                    dataParams: { ...oldbrowserProps.dataParams, ...fields },
                                    conditionDataParams: { ...oldbrowserProps.conditionDataParams, ...fields },
                                    completeParams: { ...oldbrowserProps.completeParams, ...fields },
                                }
                            }
                        });
                    }

                }
            });
        });
    }

    @action
    doBatchEdit_datakey = (callback?: any, params?: any, isQuickSearch?) => {
        let selectedRowKeysStr = '';
        if (typeof (this.treeKey) != "undefined" && this.isTreeType != '1') { //分组列表
            this.treeKey.forEach(element => {
                selectedRowKeysStr += '\'' + element + '\',';
            });
        } else if (this.selectRowkeys && this.selectRowkeys.length > 0) {
            this.selectRowkeys.forEach(element => {
                selectedRowKeysStr += '\'' + element + '\','
            });
        } else {
            this.newTable.selectedRowKeysAllPages.forEach(element => {
                selectedRowKeysStr += '\'' + element + '\',';
            });
        }
        if (selectedRowKeysStr.endsWith(',')) {
            selectedRowKeysStr = selectedRowKeysStr.substring(0, selectedRowKeysStr.length - 1);
        }
        // let keys = _.keys(this.quickSearchFormData);
        // let isQuickSearch = keys.length;

        let isQuickSearch1 = false;
        const quickSearchFormData = toJS(this.quickSearchFormData);
        if (quickSearchFormData && JSON.stringify(quickSearchFormData) !== '{}') {
            isQuickSearch1 = true;
        }

        if (!isQuickSearch) {
            this.quickSearchValue = '';
        }

        let linkParams = {};
        let linkFields = this.copyDataSource && this.copyDataSource.linkFields || '';
        if (linkFields) {
            linkParams = {
                [linkFields]: this.copyDataSource[linkFields],
                linkFields: linkFields
            }
        }

        API.dataKey({
            ...params,
            ...this.params,
            customid: this.customId,
            selectedRowKeysStr,
            groupValue: this.top.selectedKey,
            ...isQuickSearch1 ? { isQuickSearch: "1", ...this.quickSearchFormData } : {},
            ...isQuickSearch ? { quickSearchValue: this.quickSearchValue } : this.getConditionValues(),
            ...linkParams,
            isEdit: this.isEdit
        }).then(action(({ error, status, datas }) => {
            if (status == '1') {
                this.editTableStore.oldDataRecord = [];
                this.sessionKey = datas;
                getTableCounts({ dataKey: datas }).then(({ count }) => {
                    this.editPagination.total = count;
                });
                if (this.displayType === SearchDisplayType.Excel) {
                    callback(this.sessionKey);
                    return;
                }
                this.getEditDatas();
            } else {
                message.error(error)
                throw error;
            }
        }));
    }

    // 相册数据
    selectRowKey = (t) => {
        if (this.disquerycheck != '1') {
            const selectRowkey: string[] = [];
            const tempvalue = jQuery(`#imgtpyeselectCol${t}`).text();
            if (this.selectRowkeys.indexOf(tempvalue) > -1) {
                this.selectRowkeys.forEach((item) => {
                    if (item != tempvalue) {
                        selectRowkey.push(item);
                    }
                });
                this.selectRowkeys = selectRowkey;
            } else {
                this.selectRowkeys.push(tempvalue);
            }
            this.setImgSelectValue(_.uniq(this.selectRowkeys.map(d => d.split('_')[0])).join(','));
        }
    }

    setImgSelectValue = (imgSelectValue) => {
        this.imgSelectValue = imgSelectValue;
    }

    getAllImgListIds = () => {
        var selectRowkey: any[] = [];
        jQuery(".td-selectCol").each((index, el) => {
            if (!this.doRealAction || (!this.filterSelectRows.includes(el.textContent))) {
                selectRowkey.push(el.textContent);
            }
        })
        return selectRowkey;
    }

    selectRowKeyAll = (isClear?) => {
        let selectStr = ''
        if (isClear) {
            this.selectRowkeys = [];
        } else {
            jQuery(".td-selectCol").each((index, el) => {
                if (!this.doRealAction || (!this.filterSelectRows.includes(el.textContent))) {
                    this.selectRowkeys.push(el.textContent);
                }
            })
            selectStr = _.uniq(this.selectRowkeys.map(d => d.split('_')[0])).join(',');
        }
        this.setImgSelectValue(selectStr);
    }

    @action
    getListInfoForImgSearch = (customid = this.customId) => {
        API.getTitleField({ customid: customid }).then(action(({ error, status, titleField, datashowinfo, userInfo }) => {
            if (status == '1') {
                this.titleField = titleField;
                this.dataShowInfo = datashowinfo;
                this.userInfo = userInfo;
            } else {
                message.error(error)
                throw error;
            }
        }));
    }

    @action
    getEditDatas = () => {
        this.loading = true;
        getTableDatas({
            ...this.editPagination,
            dataKey: this.sessionKey
        }).then(action(({ status, errorCode, error, datas }) => {
            if (status == '1') {
                if (this.mergeFields && this.mergeInfos && this.mergeInfos.length > 0) {//如果是合并列批量修改之后继续修改需要吧columns赋值为合并列处理前的值
                    this.editTableStore.columns = this.mergeTempColumns;
                }
                let textareas = this.editTableStore.columns.filter(item => item.conditionType == 'textarea').map(item => item.key);
                const data = datas.map((item) => {
                    textareas.forEach(ele => {
                        item[ele] = item[ele].replace(/<br\/>/g, '\n');
                    });
                    return {
                        _modified_: false,
                        randomkey: item.randomFieldId + '_' + item.randomFieldSubKeyd_id, ...item
                    }
                });
                this.editTableStore.initTableForm([]);
                this.editTableStore.updateDatas(data);
                datas.map((item, index) => {
                    //oldValue赋值
                    //const datamap = {};
                    this.editTableStore.columns.map(element => {
                        this.editTableStore.form.$(`tableForm.${item.randomFieldId + '_' + item.randomFieldSubKeyd_id}.${element.key}`).oldValue = item[element.key];
                        this.getSqlNeedFieldKey(item, index, element, this.editTableStore);
                    });
                });
                let tempColumns = this.editTableStore.columns;
                this.editTableStore.columns = this.dealmergecolumn(tempColumns);
            } else {
                message.error(`[${getLabel(127353, '错误') + errorCode}]:${error}`);
            }
            this.loading = false;
            this.editTableStore.isDataLoaded = true;
        }));
    }

    @action
    doBack = () => {
        this.rightMenus = this.tempRightMenus;
        if (this.displayType === 'treeType') {
            this.treeKey = [];
        }
		let linkParams = {};
        let linkFields = this.copyDataSource && this.copyDataSource.linkFields || '';
        if (linkFields) {
            linkParams = {
                [linkFields]: this.copyDataSource[linkFields],
                linkFields: linkFields
            }
        }
        if (this.displayType === SearchDisplayType.Excel) {
            this.excelStore.changedValues = {};
            this.excelStore.insertedRows = [];
            this.dataKey({
                ...this.params,
                customid: this.customId,
                ...this.quickSearchValue ? { quickSearchValue: this.quickSearchValue } : this.getConditionValues(),
                groupValue: this.top.selectedKey,
				...linkParams,
                ...this.quickConditions
            });
            this.excelStore.editable = false;
            this.isEdit = false;
            return;
        }
        this.isEdit = false;
        if (this.displayType === SearchDisplayType.ImgType) {
            this.newTable.datas = [];
        }
        let isQuickSearch = false;
        if (this.quickSearchFormData && JSON.stringify(this.quickSearchFormData) !== '{}') {
            isQuickSearch = true;
        }
        
        this.newTable.pageSize = this.editPagination.pageSize;
        this.dataKey({
            ...this.params,
            customid: this.customId,
            ...this.quickSearchValue ? { quickSearchValue: this.quickSearchValue } : this.getConditionValues(),
            groupValue: this.top.selectedKey,
            ...linkParams,
            ...this.quickConditions,
            ...isQuickSearch ? { isQuickSearch: "1", ...this.quickSearchFormData } : {},
        });
        this.selectedRowKeys = [];
        this.selectRowkeys = [];
    }

    @action
    doBatchStorage = () => {
        if (flag1) {
            return;
        }
        flag1 = true;
        let data: any = [];
        let oldData: any = [];
        if (this.displayType === SearchDisplayType.Excel) {
            flag1 = false;
            return this.excelStore.doBatchStorage();
        }
        this.editTableStore.oldDataRecord.forEach(v => {
            let d: any = _.findKey(data, function (o) { return o.randomFieldId == v.randomFieldId && o.randomFieldSubKeyd_id == v.randomFieldSubKeyd_id });
            let o_d: any = _.findKey(oldData, function (o) { return o.randomFieldId == v.randomFieldId && o.randomFieldSubKeyd_id == v.randomFieldSubKeyd_id });
            let m_data = { randomFieldId: v.randomFieldId, randomFieldSubKeyd_id: v.randomFieldSubKeyd_id };
            let old_data = { randomFieldId: v.randomFieldId, randomFieldSubKeyd_id: v.randomFieldSubKeyd_id, changeDataTime: this.changeDataTime };
            if (d && o_d) {
                m_data = data[d];
                old_data = oldData[o_d];
                m_data[v._fieldid] = v[v._fieldid];
                old_data[v._fieldid] = v.oldValue;
            } else {
                m_data[v._fieldid] = v[v._fieldid];
                old_data[v._fieldid] = v.oldValue;
                data.push(m_data);
                oldData.push(old_data);
            }
        });
        if (data.length == 0) {
            message.warn(getLabel(385557, '未做任何修改！'));
            flag1 = false;
            return;
        }
        //重复验证
        API.batchEditGetVerifyField({ customid: this.customId }).then(action(({ error, status, result }) => {
            if (status == '1') {
                if (result && result.VerifyField && result.VerifyField.length > 0) {
                    let fields = '';
                    result.VerifyField.forEach(element => {
                        fields += element.fieldids + ',';
                    });
                    // let isEdit = false;
                    API.checkDataChange({ oldData: JSON.stringify(oldData), customid: this.customId }).then(action(({ errMessage, datas }) => {
                        if (errMessage && errMessage != '') {
                            this.isBatchSubmit = false;
                            Modal.confirm({
                                title: errMessage,
                                okText: getLabel(382958, '确定'),
                                cancelText: getLabel(201, '取消'),
                                onOk: () => {
                                    datas.map(item => {
                                        let index = _.findIndex(oldData, function (o:any) { return o['id'] == item.id; });
                                        oldData.splice(index, 1);
                                        data.splice(index, 1);
                                    })
                                    // isEdit = true;
                                    data = JSON.stringify(data);
                                    oldData = JSON.stringify(oldData);
                                    if (errMessage != getLabel(508326, '本次编辑的所有数据已被修改，本次修改无效，请重新刷新页面')) {
                                        this.doBatchEditSave(data, oldData);
                                    }
                                },
                                onCancel: () => {
                                    return;
                                }
                            });
                            flag1 = false;
                        }
                        // if (fields == '' && isEdit) {
                        // }
                    }));
                    var fieldArray = fields.split(',');
                    var verifyDataObj = new Array();
                    let datas = this.editTableStore.form.$(`tableForm`).values();
                    let columns = this.editTableStore.columns;
                    datas.forEach((item, index) => {
                        var fieldvalues = {};
                        fieldArray.forEach((fieldid, index) => {
                            columns.forEach(element => {
                                if (element.fieldid == fieldid) {
                                    fieldvalues['pluginName' + fieldid] = item[element.key];
                                }
                            });
                        });
                        fieldvalues[result.primaryKeyPluginName] = item['randomFieldId'];
                        if (result.detailPrimaryKeyPluginName) {
                            fieldvalues[result.detailPrimaryKeyPluginName] = item['randomFieldSubKeyd_id'];
                        }
                        fieldvalues['^_^rownum^_^'] = index;
                        verifyDataObj.push(fieldvalues);
                    });
                    var jsonstr = JSON.stringify(verifyDataObj);
                    API.batchEditVerifyData({
                        customid: this.customId,
                        data: jsonstr
                    }).then(action(({ error, status, result, colorMap }) => {
                        if (status == '1') {
                            this.checkFail(result, this.doBatchEditSave, data, oldData, columns, colorMap);
                        } else {
                            message.error(error)
                            throw error;
                        }
                    }));

                } else {
                    let oldDatas = JSON.stringify(oldData);
                    API.checkDataChange({ oldData: oldDatas, customid: this.customId }).then(action(({ errMessage = '', datas, isAllData }) => {
                        if (errMessage != '') {
                            Modal.confirm({
                                title: errMessage,
                                okText: getLabel(382958, '确定'),
                                cancelText: getLabel(201, '取消'),
                                onOk: () => {
                                    if (isAllData) {
                                        datas.map(item => {
                                            let index = _.findIndex(oldData, function (o:any) { return o['id'] == item.id; });
                                            oldData.splice(index, 1);
                                            data.splice(index, 1);
                                        });
                                        data = JSON.stringify(data);
                                        oldData = JSON.stringify(oldData);
                                        this.doBatchEditSave(data, oldData);
                                    } else {
                                        return;
                                    }
                                },
                                onCancel: () => {
                                    return;
                                }
                            });
                            flag1 = false;
                        } else {
                            data = JSON.stringify(data);
                            oldData = JSON.stringify(oldData);
                            this.doBatchEditSave(data, oldData);
                        }
                    }));
                }
            } else {
                message.error(error)
                throw error;
            }
        }));
    }

    //重复验证返回信息处理
    checkFail = (result, func, data, oldData, columns, colorMap) => {
        $($('.cube-table-fixed')[1]).find('td').css('backgroundColor', '');
        if (result.verify || result.confirmbefore && result.confirmbefore.verify) {
            var detail = result.detail;
            detail && detail.forEach((elem, index) => {
                let columnsIndex = elem.fields.map(element => {
                    return _.findIndex(columns, function (o: any) {
                        let fieldname = element.detailtable ? 'd_' + element.fieldname : element.fieldname;
                        const { fieldhtmltype, fieldtype } = o;
                        if (fieldhtmltype == '1') {
                            if (fieldtype == '3' || fieldtype == '4' || fieldtype == '5') {//浮点数 金额转换 金额千分位
                                fieldname += 'span';
                            }
                        } else if (fieldhtmltype == '2') {
                            if (fieldtype == '1') {
                                fieldname += 'span';
                            }
                        }
                        return o['key'] == fieldname;
                    })
                });
                let tableNode: any = document.getElementsByClassName('cube-table-fixed')[1];
                if (elem.rownums != null && elem.rownums != undefined && elem.rownums.constructor == Number) elem.rownums = [elem.rownums];
                elem.rownums && (elem.rownums.constructor == Array) && elem.rownums.forEach(rowNum => {
                    columnsIndex.forEach(columnNum => {
                        if (tableNode.rows[rowNum] && tableNode.rows[rowNum].cells[columnNum]) {
                            tableNode.rows[rowNum].cells[columnNum].style.backgroundColor = colorMap[elem.verifyid];
                        }
                    });
                });
            });
            var operate = result.operate || result.confirmbefore && result.confirmbefore.operate;
            if (!operate) {
                operate = '0';
            }
            if (operate == '0') {
                if (this.isBatchSubmit) {
                    Modal.info({
                        title: '提示',
                        width: 500,
                        content: <div dangerouslySetInnerHTML={{ __html: result.msg }} style={{ maxHeight: 600, overflowY: 'auto' }} />,
                        onOk() {
                        },
                    });
                    flag1 = false;
                }
            } else {
                if (result.confirmbefore) {
                    this.checkFail(result.confirmbefore, () => {
                        Modal.confirm({
                            width: 500,
                            title: <div dangerouslySetInnerHTML={{ __html: result.msg || getLabel(15382, '是否继续？') }} style={{ maxHeight: 600, overflowY: 'auto' }} />,
                            okText: getLabel(382958, '继续'),
                            cancelText: getLabel(201, '取消'),
                            onOk: () => {
                                func && func(data, oldData);
                            },
                            onCancel: () => {
                                flag1 = false;
                            }
                        });
                    }, data, oldData, columns, colorMap);
                } else {
                    Modal.confirm({
                        width: 500,
                        title: <div dangerouslySetInnerHTML={{ __html: result.msg }} style={{ maxHeight: 600, overflowY: 'auto' }} />,
                        okText: getLabel(382958, '继续'),
                        cancelText: getLabel(201, '取消'),
                        onOk: () => {
                            func && func(data, oldData);
                        },
                        onCancel: () => {
                            flag1 = false;
                        }
                    });
                }
            }
        } else {
            if (this.isBatchSubmit) {
                data = JSON.stringify(data);
                oldData = JSON.stringify(oldData);
                this.doBatchEditSave(data, oldData);
            }
        }
        this.isBatchSubmit = true;
    }

    @action
    openMsgConfirm = (visible, data?, oldData?) => {
        this.msgConfirmVisible = visible;
        if (visible) {
            this.msgConfirmData = data;
            this.msgConfirmOldData = oldData;
        } else {
            this.msgConfirmData = null;
            this.msgConfirmOldData = null;
            flag1 = false; //可以再次保存
        }
    };

    @action
    onBatchEditSave = (needContinueEdit) => {
        let data: any = this.msgConfirmData;
        let oldData: any = this.msgConfirmOldData;
        if (typeof data == 'object') {
            data = JSON.stringify(data);
        }
        if (typeof oldData == 'object') {
            oldData = JSON.stringify(oldData);
        }
        API.batchEditSave({ ...this.params, customid: this.customId, data, oldData }).then(action(({ error, status, resultMessage, changeDataTime, pageExpendResult }) => {
            if (status == '1') {
                const mythis = this;
                this.changeDataTime = changeDataTime;
                this.editTableStore.oldDataRecord = [];
                if (pageExpendResult && pageExpendResult.haveError) {
                    showExpendError(pageExpendResult, "/spa/cube/index.html#/main/cube/search?customid=" + this.customId + "&");
                    mythis.doBatchEdit_datakey();
                    return;
                }
                if (needContinueEdit) {
                    mythis.doBatchEdit_datakey();
                    $($('.cube-table-fixed')[1]).find('td').css('backgroundColor', '');
                } else {
                    mythis.doBack();
                }
                this.openMsgConfirm(false);
            } else {
                message.error(error);
                throw error;
            }
            flag1 = false;
        }));
    }

    @action
    doBatchEditSave = (data, oldData) => {
        this.openMsgConfirm(true, data, oldData);
    };


    batchEditGoBack = () => {
        this.listEditStore.back();
    }

    Add = () => {
        let fields = '';
        let treeconid = '';
        let treecontype = '';//目标字段类型
        let treecon_value = '';
        for (let key in this.params) {
            let fieldvalue = this.params[key];
            //afterConditionInit方法中对数值类型的设置为了数组类型导致这里fieldvalue都多了一个逗号,没敢改那里,这里做个设置,取第一项
            if (Array.isArray(toJS(fieldvalue))) {
                fieldvalue = fieldvalue[0]
            }
            if (key.startsWith('con_')) {
                let fieldKey = key.replace('con_', 'field');
                fields = `${fields}&${fieldKey}=${fieldvalue}`;
            }
            if (key.startsWith('p_')) {
                let fieldKey = key;
                fields = `${fields}&${fieldKey}=${fieldvalue}`;
            }
            if (key.startsWith('treecon') && key.indexOf('_value') > 0) {
                treecon_value = fieldvalue;
            }
            if (key == 'treeconid') {
                treeconid = fieldvalue;
            }
            if (key == 'treecontype') {
                treecontype = fieldvalue;
            }
        }
        if (treeconid != '' && treecon_value != '' && treecontype != '') {
            if (treecontype == '161' || treecontype == '162') {
                let index = treecon_value.indexOf('_');
                if (index > 0) {
                    treecon_value = treecon_value.substring(index + 1);
                }
            }
            fields = `${fields}&field${treeconid}=${treecon_value}`;
        }
        window.open(`/spa/cube/index.html#/main/cube/card?type=1&modeId=${this.modeId}&formId=${this.formId}${fields}${this.treeFieldStr ? this.treeFieldStr : ''}`)
    }
    Del = (pageexpandid: string) => {
        if (!this.checkSeleted()) {
            return;
        }
        const that = this;
        let ids = this.getCheckedIds();
        Modal.confirm({
            title: getLabel(129890, '确定要删除吗?', 'label'),
            okText: getLabel(382958, '确定'),
            okType: 'danger',
            cancelText: getLabel(201, '取消'),
            onOk() {
                let id = ids.split(",");
                if (id.length >= 20) {
                    API.doDelLoadingpost({ billids: ids }).then(action(({ error, status, key, canExpObj }) => {
                        if (status == '1') {//成功
                            that.delkey = key;
                            that.isDelShow = true;
                            that.deleteData({
                                    ...that.params,
                                    customid: that.customId,
                                    operate: 'DeleteAction',
                                    billids: ids,
                                    pageexpandid,
                                    key: that.delkey,
                                    modeId: that.modeId
                                },
                                ({ message }) => {
                                    Modal.success({
                                        content: message,
                                    });
                                    that.refresh();
                                }
                            );
                            that.getDelLoadingProgress();
                        } else {
                            message.error(error);
                        }
                    }));
                } else {
                    that.deleteData({
                            ...that.params,
                            customid: that.customId,
                            operate: 'DeleteAction',
                            billids: ids,
                            pageexpandid,
                            modeId: that.modeId
                        },
                        ({ message }) => {
                            Modal.success({
                                content: message,
                            });
                            that.refresh();
                        }
                    );
                }


            }
        });

    }

    getDelLoadingProgress = () => {
        API.getDelLoadingProgress({ key: this.delkey }).then(action(({ error, status, progress }) => {
            if (status == '1') {//成功
                if (!this.isCancel) {
                    this.delLoadingProgress = progress;
                    if (progress.step == 'end') {
                        this.isDelShow = false;
                        this.delLoadingProgress = {};
                    } else {
                        setTimeout(() => {
                            this.getDelLoadingProgress();
                        }, 1000);
                    }
                }
            } else if (status == '2') {
                message.info(error);
            } else {
                message.error(error);
            }
        }));
    }

    getAllExcelOut = (billid) => {   //导出
        let allIds = _.uniq(this.newTable.selectedRowKeysAllPages.map(d => d.split('_')[0])).join(',');
        if (this.displayType == SearchDisplayType.TreeType && this.treeKey) {
            allIds = this.treeValueId;
        }
        if (this.selectRowkeys && this.selectRowkeys.length > 0) {
            allIds = _.uniq(this.selectRowkeys.map(d => d.split('_')[0])).join(',');
        }
        doExpCardConfig({
            action: 'getBacthExpList',
            customid: this.customId,
            modeid: this.modeId
        }).then((data: any) => {
            try {
                if (Number(this.modeId) > 0) {
                    if (data.canExpObj && !data.canExpObj.canExp) {
                        Modal.info({
                            title: getLabel(15172, '系统提示'),
                            content: (
                                <div>
                                    {data.canExpObj.canExpMsg}
                                </div>
                            ),
                            onOk() {
                            },
                        });
                        return;
                    }
                    const billids = allIds;
                    if (data.BacthExplist.length > 0 || (data.expcardname && data.expcardname.key == '1')) {
                        if (data.BacthExplist.length == 1 && data.expcardname.key != '1') {   //当后台设置了一种导出类型的时候直接导出
                            const key = data.BacthExplist[0]['key'];
                            if (key == "list") {
                                this.doExcelExpost(allIds, data.expcardname.showname);
                            } else {
                                let parms = {
                                    action: "expbatchcard",
                                    fileType: data.BacthExplist[0]['key'],
                                    billids: billids,
                                    modeId: this.modeId,
                                    comefrom: 'frommode',
                                    modeCustomid: this.customId,
                                    dataKey: this.sessionKey,
                                    excelName: data.expcardname.showname
                                }
                                this.doExcelExpost(billids, '', parms);
                            }
                            // window.open(`/weaver/weaver.formmode.expcard.servlet.ExpCardServer?action=expbatchcard&fileType=${data.BacthExplist[0]['key']}&billids=${billids}&modeId=${this.modeId}`);
                        } else {
                            let cube_export_type = data.BacthExplist.length > 0 ? data.BacthExplist[0]['key'] : 'list'
                            WeaTools.ls.set('cube_export_type', cube_export_type);
                            WeaTools.ls.set('cube_export_name', data.expcardname.showname);
                            this.expCardParm = {
                                datas: data.BacthExplist,
                                billsid: allIds,
                                modeid: this.modeId,
                                type: 'list',
                                comefrom: "frommode",
                                modeCustomid: this.customId,
                                dataKey: this.sessionKey,
                                expcardname: data.expcardname,
                                callBack: this.doExcelExpost
                            };
                            this.showExpList = true;
                        }
                    } else {
                        this.doExcelExpost(allIds, data.expcardname.showname);
                    }
                } else {
                    this.doExcelExpost(allIds, data.expcardname.showname);
                }
            } catch (error) {

            }
        })

    }

    @action
    doExcelExpost = (allIds, excelName, cardparm?) => {//cardparm 批量导出文件才传 默认excel导出不传
        // const allIds = _.uniq(this.newTable.selectedRowKeysAllPages.map(d => d.split('_')[0])).join(',');
        const selectedRows = allIds;
        this.starttime = new Date().getTime();
        this.progress = {};
        this.isCancel = false;
        this.isClose = false;
        this.exportkey = '';
        let params: any;
        if (this.changeSearch == '0') {
            this.isExpTree = "";
        } else if (this.changeSearch == '1') {
            this.isExpTree = "1";
        }
        if (cardparm) {//批量导出文件
            let Base64 = WeaTools.Base64;
            let modeCustomid = Base64.encode(this.customId);
            params = { ...cardparm, exptype: 'card' };
            params.modeCustomid = modeCustomid;
        } else {//默认excel导出
            let Base64 = WeaTools.Base64;
            let modeCustomid = Base64.encode(this.customId);
            params = {
                showOrder: 'all',
                iscustomsearch: 1,
                comefrom: 'frommode',
                excelName: excelName,
                isexptree: this.isExpTree,
                modeCustomid: modeCustomid,
                dataKey: this.sessionKey,
                isSelectGroup: this.top.selectedKey != 'all',
                exptype: 'excel'
            };
            if (selectedRows.length > 0) {
                let Base64 = WeaTools.Base64;
                let ids = Base64.encode(selectedRows);
                params.ids = ids;
            }
        }

        API.doExcelExpost(params).then(action(({ error, status, key, canExpObj }) => {
            if (status == '1') {//成功
                // message.info(getLabel('508305', '正在导出文件'));
                this.exportkey = key;
                this.showProgerss = true;
                this.getExcelExpProgress();
            } else if (status == '2') {
                message.info(error);
                this.refresh();
            } else if (status == '3') {
                Modal.info({
                    title: getLabel(15172, '系统提示'),
                    content: (
                        <div>
                            {canExpObj.canExpMsg}
                        </div>
                    ),
                    onOk() {
                    },
                });
                return;
            } else {
                message.error(error);
            }
        }));
        // formPost("/weaver/weaver.formmode.excel.ExpExcelServer", params);
    }

    getExcelExpProgress = () => {
        API.getExcelExpProgress({ key: this.exportkey }).then(action(({ error, status, progress }) => {
            if (status == '1') {//成功
                if (!this.isCancel) {
                    this.progress = progress;
                    if (progress.step == 'end') {
                        this.showProgerss = false;
                        let url = "/weaver/weaver.formmode.data.FileDownload?type=listExcelOut&key=" + this.exportkey + "&filename=" + encodeURI(progress.filename);
                        if (progress.zipkey) {
                            url += "&zipkey=" + progress.zipkey;
                        }
                        window.location.href = url;
                        this.progress = {};
                    } else {
                        setTimeout(() => {
                            this.getExcelExpProgress();
                        }, 1000);
                    }
                }
            } else if (status == '2') {
                message.info(error);
            } else {
                message.error(error);
            }
        }));
    }

    cancelExport = () => {
        const that = this;
        Modal.confirm({
            title: getLabel('509723', '确定取消本次导出') + "?",
            okText: getLabel(382958, '确定'),
            cancelText: getLabel(201, '取消'),
            onOk: () => {
                that.showProgerss = false;
                that.isCancel = true;
                API.cancelExcelExp({ key: that.exportkey }).then(action(({ error, status }) => {
                    if (status == '1') {//成功

                    } else if (status == '2') {
                        message.info(error);
                    } else {
                        message.error(error);
                    }
                }));
            },
            onCancel: () => {
                return;
            }
        });
    }

    /****
     * y用来公用获取选中id的
     */
    getCheckedIds = () => {
        let ids = this.treeValueId == "" ?
            this.imgSelectValue == "" ?
                this.verticalListStore.selectValue == '' ? window._xtable_CheckedCheckboxId()
                    : this.verticalListStore.selectValue
                : this.imgSelectValue
            : this.treeValueId;
        return ids
    }

    //批量打印
    doBatchPrint = (pageexpandid: string, printEdcUrl?: string) => {
        let ids = this.getCheckedIds();
        let id = ids.split(",");
        let msg = getLabel(504438, "请勾选打印的数据");
        if (ids == '') {
            Modal.confirm({
                title: "",
                content: msg,
                width: 300,
                onOk() {
                    return;
                }
            });
        } else if (id.length > 20) {
            msg = getLabel(504440, "请勾选打印的数据");
            Modal.confirm({
                title: "",
                content: msg,
                width: 300,
                onOk() {
                    return;
                }
            });
        } else {
            if (printEdcUrl && printEdcUrl != '') {
                let printUrl = printEdcUrl + "&cubePrintKey=" + id;
                window.openFullWindowHaveBar(printUrl);
            } else {
                window.openFullWindowHaveBar(`/spa/cube/index.html#/main/cube/BatchPrint?modeId=${this.modeId}&customId=${this.customId}&formId=${this.formId}&billId=${this.getCheckedIds()}&windowTitle=${WeaTools.Base64.encode(this.printWindowTitle)}`);
            }
        }
    }
    ChangeSearch = () => {     //查询转换
        this.quickSearchValue = "";
        this.quickSearchFormData = {};
        if (this.quickSearchConditionData) {
            for (var key in this.quickSearchConditionData) {
                if (this.condition.form.has(key)) this.condition.form.$(key).value = "";
            }
        }
        this.quickSearchConditionData = {};
        if (this.changeSearch == '1') {
            this.isTreeType = '1';
            this.dataKey(this.params)
        } else if (this.changeSearch == '0') {
            this.isTreeType = '';
            this.dataKey(this.params)
        }
    }
    columnMake = () => {
        this.newTable.tableColSet(true);
        this.newTable.setColSetVisible(true);
        let timer;
        let func = () => {
            if (this.newTable.colSetVisible) {
                clearInterval(timer);
                timer = setInterval(() => {
                    //  this.newTable.colSetVisible
                    if (!this.newTable.colSetVisible) {
                        API.getOriginalTableWidth({ customid: this.customId }).then(action(({ error, status, originalTableWidth }) => {
                            if (status == '1' && originalTableWidth) {//成功
                                this.originalTableWidth = originalTableWidth;
                            } else if (status == '2') {
                                message.info(error);
                            } else {
                                message.error(error);
                            }
                        }));
                        this.addRightMenu();
                        clearInterval(timer);
                    }
                }, 50)
            }
        }
        func();
    }
    batchCreateQRCode = () => {
        if (!this.checkSeleted()) {
            return;
        }
        this.check_uses('getQrCode', () => {
            window.modeopenFullWindowHaveBar(`/spa/cube/index.html#/main/cube/qrCode?modeId=${this.modeId}&customId=${this.customId}&formId=${this.formId}&billId=${this.getCheckedIds()}`);
        });
    }
    batchCreateBARCode = () => {
        if (!this.checkSeleted()) {
            return;
        }
        this.check_uses('getBarCode', () => {
            window.open(`/spa/cube/index.html#/main/cube/barCode?modeId=${this.modeId}&customId=${this.customId}&formId=${this.formId}&billId=${this.getCheckedIds()}`);
        });
    }
    showMapPage = () => {   //右键地图
        const { selectedRowKeys } = this.newTable;
        let ids = this.treeValueId == "" ?
            this.imgSelectValue == "" ?
                this.verticalListStore.selectValue == '' ? selectedRowKeys
                    : this.verticalListStore.selectValue
                : this.imgSelectValue
            : this.treeValueId;
        window.modeopenFullWindowHaveBar(`/spa/cube/index.html#/main/cube/map?customid=${this.customId}&billids=${ids}`)
    }
    batchEditSave = () => {
        this.listEditStore.batchSave();
    }
    @action
    doCustomAction = (menu: any) => {
        if (menu.isfilter == 1 && !this.doRealAction) {//设置了数据筛选的按钮第一次点击的时候禁用check框
            this.resetMenu(menu.key);
        } else {
            if (menu.key == '-100') {
                this.onclickCancel();
                return;
            }
            if (menu.function) {
                try {
                    const func = eval(`this.${menu.function}`);
                    if (typeof func == 'function') {
                        if (menu.function == 'doBatchPrint') {
                            func(menu.key, this.printEdcUrl);
                        } else {
                            func(menu.key);
                        }
                    }
                } catch (e) {
                    message.error(e);
                    throw e;
                }
            }
        }
    }
    BatchImport = (pageexpandid: string) => {
        // window.open(`/formmode/interfaces/ModeDataBatchImport.jsp?ajax=1&modeid=${this.modeId}&pageexpandid=${pageexpandid}`);
        window.open(`/spa/cube/engine.html#/cubeengine/app/modebatchimport?modeid=${this.modeId}&customid=${this.customId}`);

    }
    @action
    CleanCol = () => {
        API.cleanCol({ customid: this.customId }).then(action(({ error, status, }) => {
            if (status == '1') {
                window.location.reload();
            } else {
                message.error(error)
                throw error;
            }
        }));

    }
    batchShare = () => {
        this.share.batchShare(this);
    }

    batchmodifyfeildvalue = (key) => {
        let selectedRows: String[];
        if (typeof (this.treeKey) != "undefined" && this.isTreeType != '1') {
            selectedRows = _.uniq(this.treeKey.map(d => d.split('_')[0]));
            if (selectedRows && selectedRows.length > 0) {
                this.batchEditStore.selectedRowKeys = selectedRows;
                this.batchEditStore.pageexpandid = key;
                this.batchEditStore.customid = this.customId;
                this.batchEditStore.showBatctEdit(this.dataKey, this.getConditionValues());
            } else {
                Modal.info({
                    title: getLabel(15172, '系统提示'),
                    content: getLabel(20149, '请至少选择一条记录。')
                })
            }
        } else if (typeof (this.selectRowkeys) != "undefined" && this.selectRowkeys.length > 0) {
            selectedRows = _.uniq(this.selectRowkeys.map(d => d.split('_')[0]));
            if (selectedRows && selectedRows.length > 0) {
                this.batchEditStore.selectedRowKeys = selectedRows;
                this.batchEditStore.pageexpandid = key;
                this.batchEditStore.customid = this.customId;
                this.batchEditStore.showBatctEdit(this.reload);
            } else {
                Modal.info({
                    title: getLabel(15172, '系统提示'),
                    content: getLabel(20149, '请至少选择一条记录。')
                })
            }
        } else {
            selectedRows = _.uniq(this.newTable.selectedRowKeysAllPages.map(d => d.split('_')[0]));
            if (selectedRows && selectedRows.length > 0) {
                this.batchEditStore.selectedRowKeys = selectedRows;
                this.batchEditStore.pageexpandid = key;
                this.batchEditStore.customid = this.customId;
                this.batchEditStore.showBatctEdit(this.reload);
            } else {
                Modal.info({
                    title: getLabel(15172, '系统提示'),
                    content: getLabel(20149, '请至少选择一条记录。')
                })
            }
        }
    }
    modeOpenUrl = (operate: any, record: any, _: number, url: string, _bank: string) => {
        if (operate.linkkey && operate.linkvaluecolumn) {
            //多个参数
            url = url.indexOf('?') >= 0 ? url + "&" : url + "?";
            let linkkeys = operate.linkkey.split(",");
            let linkvaluecolumns = operate.linkvaluecolumn.split(",");
            if (linkvaluecolumns.length === linkkeys.length) {
                linkkeys.forEach((key, i) => {
                    url += `${key}=${record[linkvaluecolumns[i]] || record['randomField' + i] || ''}&`;
                });
            } else {
                url += `${operate.linkkey}=${record[operate.linkvaluecolumn] || ''}`;
            }
            url = url.endsWith('&') ? url.substr(0, url.length - 1) : url;

        }
        if ('_blank' == _bank) {
            window.location.href = url;
        } else {
            window.modeopenFullWindowHaveBar(url);
        }
    }
    createBARCode = (billid: string, text: string, expandid: string) => {
        this.check_uses('getBarCode', () => {
            this.doInterfacesAction([billid], expandid, () => {
                // CubeUtil.createBARCode(billid, text, this.customId, this.modeId, this.formId)
                this.customDialog.showCustomDialog(getBarCode, {
                    customId: this.customId,
                    modeId: this.modeId,
                    formId: this.formId,
                    billid: billid
                }, 'barCode', getLabel(1362, '条形码'));
            })
        }, billid);
    }
    createQRCode = (billid: string, text: string, expandid: string) => {
        this.check_uses('getQrCode', () => {
            this.doInterfacesAction([billid], expandid, () => {
                // CubeUtil.createQRCode(billid, text, this.customId, this.modeId, this.formId);
                this.customDialog.showCustomDialog(getQRCode, {
                    customId: this.customId,
                    modeId: this.modeId,
                    formId: this.formId,
                    billid: billid
                }, 'qrCode', getLabel(30184, '二维码'));
            })
        }, billid);
    }

    check_uses = (type: string, callback: Function, billid?: string) => {
        API[type]({
            'modeId': this.modeId,
            'customId': this.customId,
            'formId': this.formId,
            'billId': `${this.getCheckedIds()}` || billid
        }).then(({ status, showError, message, error, html }) => {
            if (status == '1') {
                if (showError) {
                    Modal.error({ content: message, align: 'top', className: 'cube-custom-dialog-error' });
                } else {
                    callback();
                }
            } else {
                message.error(error);
            }
        })
    }

    viewLog = (billid: string, text: string, expandid: string) => {
        this.doInterfacesAction([billid], expandid, () => {
            CubeUtil.viewLog(billid, text, this.modeId, this.modename)
        })
    }
    toEdit = (billid: string, text: string, expandid: string) => {
        this.doInterfacesAction([billid], expandid, () => {
            CubeUtil.toEdit(billid, text, this.modeId, this.formId)
        })
    }
    doprint = (billid: string, text: string, expandid: string) => {
        this.doInterfacesAction([billid], expandid, () => {
            CubeUtil.doprint(billid, text, this.modeId, this.formId)
        })
    }
    toDel = (billid: string, _: string, pageexpandid: string) => {
        const self = this;
        Modal.confirm({
            title: getLabel(129890, '确定要删除吗?', 'label'),
            okText: getLabel(382958, '确定'),
            okType: 'danger',
            cancelText: getLabel(201, '取消'),
            onOk() {
                self.deleteData({
                    ...self.params,
                    customid: self.customId,
                    operate: 'DeleteAction',
                    billids: billid,
                    pageexpandid,
                    modeId: self.modeId
                }, ({ message }) => {
                    Modal.success({
                        content: message,
                    });
                    self.refresh();
                });
            }
        })
    }

    doShare = (billid: string, _: string) => {
        this.share.update({
            singleVisible: true,
            billid
        });
    }
    openPageExpandLinkUrl = (billid: string, pageexpandid: string) => {
        const executeJsCode = (param) => {
            var hreftarget = param.hreftarget;
            eval(hreftarget);
        }
        const directlyOpenUrl = (param) => {
            window.openFullWindowHaveBar(param.hreftarget);
        }
        this.secondConfirmPrompt(pageexpandid, () => {
            API.analyzePageExpandLinkUrl({
                modeid: this.modeId,
                formid: this.formId,
                billid,
                pageexpandid,
                cardid: this.params.cardid ? this.params.cardid : ''
            }).then(({ hreftarget, opentype, showtype }) => {
                const param = { billid, hreftarget };
                if (showtype == 2 && opentype == 3) {
                    this.doPageExpandAction(billid, pageexpandid, executeJsCode, param);
                } else {
                    this.doPageExpandAction(billid, pageexpandid, directlyOpenUrl, param);
                }
            })
        })
    }
    expCard = (billid: string, _: string, pageexpandid: string) => {
        const that = this;
        // this.doInterfacesAction([billid], pageexpandid, () => {
        //     // CubeUtil.expCard(billid, _, this.modeId, this.formId);
        //    that.getSingleExcelOut(billid,pageexpandid);
        // })
        const modeid = this.modeId;
        const formid = this.formId;
        const CheckedCheckboxIds = [billid];
        API.doInterface({ pageexpandid, CheckedCheckboxIds, modeid, formid, ...this.params }).then(({ pageExpendResult, status }) => {
            if (pageExpendResult && pageExpendResult.haveError) {
                showExpendError(pageExpendResult, this.getHref());
                return;
            } else {
                that.getSingleExcelOut(billid);
            }
        });
    }
    doPageExpandAction = (billid: string, pageexpandid: string, callBackFun?: (param?: any) => void, param?: any) => {
        API.doInterface({ pageexpandid, billid, modeid: this.modeId, formid: this.formId, ...this.params }).then(({ pageExpendResult, status }) => {
            if (pageExpendResult && pageExpendResult.haveError) {
                Modal.error({
                    content: pageExpendResult.executeResult.errmsg
                })
                return;
            }
            callBackFun && callBackFun(param);
        });
    }

    @action
    likeOrDislike(record: any, key, index, type) {
        /***
         * type 列表类型 1 :normal, 0 :imgtype, 2:分组列表，5：纵向列表  [5: "赞"标签  6: "踩"标签]
         */
        const billid = record.randomFieldId;
        API.saveCubeLikeInfo({ modeid: this.modeId, billid: billid, status: key }).then((data: any) => {
            if (data.status == '1') {
                if (data.issuccess) {
                    //this.newTable.getDatas('', this.newTable.current, this.newTable.pageSize);
                    let likecount = data.likecount || '0';
                    let dislikecount = data.dislikecount || '0';
                    let likestatus = data.likestatus || '0';
                    if (type == '1' || type == '0' || type == '5' || type == '6') {
                        let isshowlistspan: any;
                        let likesinfospan: any = likecount + ',' + dislikecount + ',' + likestatus;
                        if (type == '1' || type == '0') {
                            isshowlistspan = (this.newTable.datas[index].isshowlistspan && JSON.parse(this.newTable.datas[index].isshowlistspan)) || [];
                        } else {
                            isshowlistspan = (this.verticalListStore.allDatas[index].isshowlistspan && JSON.parse(this.verticalListStore.allDatas[index].isshowlistspan)) || [];
                        }
                        let index1 = 0;
                        for (index1; index1 < isshowlistspan.length; index1++) {
                            let otherpara = isshowlistspan[index1].otherpara || '';
                            if (otherpara.indexOf('#islikebutton:1') > -1) {
                                let otherparas = isshowlistspan[index1].otherpara.split("+");
                                if (otherparas[1]) {
                                    let likeinfo = otherparas[1].replace("#likeinfo:", "")
                                    let hreftype1 = likeinfo.split(",")[0];
                                    if (hreftype1 == '5' || hreftype1 == '6') {
                                        isshowlistspan[index1].otherpara = '#islikebutton:1+#likeinfo:' + hreftype1 + ',' + likecount + ',' + dislikecount + ',' + likestatus;
                                    }
                                }
                            }
                        }
                        if (type == '1' || type == '0') {
                            this.updateLikeOrDis(billid, isshowlistspan, likesinfospan);
                        } else {
                            this.verticalListStore.updateLikeOrDis(billid, isshowlistspan, likesinfospan)
                        }
                    }
                    if (type == '2') {
                        let datas: any = this.tableData.Data;
                        let cube_expandmap = JSON.parse(datas[index].cube_expandmap);
                        let index1 = 0;
                        for (index1; index1 < cube_expandmap.length; index1++) {
                            let otherpara = cube_expandmap[index1].otherpara || '';
                            if (otherpara.indexOf('#islikebutton:1') > -1) {
                                let otherparas = cube_expandmap[index1].otherpara.split("+");
                                if (otherparas[1]) {
                                    let likeinfo = otherparas[1].replace("#likeinfo:", "")
                                    let hreftype1 = likeinfo.split(",")[0];
                                    if (hreftype1 == '5' || hreftype1 == '6') {
                                        cube_expandmap[index1].otherpara = '#islikebutton:1+#likeinfo:' + hreftype1 + ',' + likecount + ',' + dislikecount + ',' + likestatus;
                                    }
                                }
                            }
                        }
                        for (let index2 = 0; index2 < datas.length; index2++) {
                            if (datas[index2].randomfieldid == record.randomFieldId) {//第一层
                                datas[index2].cube_expandmap = JSON.stringify(cube_expandmap);
                                // break;
                            } else if (datas[index2].sublist && datas[index2].sublist.length > 0) {
                                for (let index3 = 0; index3 < datas[index2].sublist.length; index3++) {
                                    if (datas[index2].sublist[index3].randomfieldid == record.randomFieldId) {//第二层
                                        datas[index2].sublist[index3].cube_expandmap = JSON.stringify(cube_expandmap);
                                        // break;
                                    } else if (datas[index2].sublist[index3].sublist && datas[index2].sublist[index3].sublist.length > 0) {
                                        for (let index4 = 0; index4 < datas[index2].sublist[index3].sublist.length; index4++) {
                                            if (datas[index2].sublist[index3].sublist[index4].randomfieldid == record.randomFieldId) {//第三层
                                                datas[index2].sublist[index3].sublist[index4].cube_expandmap = JSON.stringify(cube_expandmap);
                                                // break;
                                            } else if (datas[index2].sublist[index3].sublist[index4].sublist && datas[index2].sublist[index3].sublist[index4].sublist.length > 0) {
                                                for (let index5 = 0; index5 < datas[index2].sublist[index3].sublist[index4].sublist.length; index5++) {
                                                    if (datas[index2].sublist[index3].sublist[index4].sublist[index5].randomfieldid == record.randomFieldId) {//第四层
                                                        datas[index2].sublist[index3].sublist[index4].sublist[index5].cube_expandmap = JSON.stringify(cube_expandmap);
                                                        // break;
                                                    } else if (datas[index2].sublist[index3].sublist[index4].sublist[index5].sublist && datas[index2].sublist[index3].sublist[index4].sublist[index5].sublist.length > 0) {
                                                        for (let index6 = 0; index6 < datas[index2].sublist[index3].sublist[index4].sublist[index5].sublist.length; index6++) {
                                                            if (datas[index2].sublist[index3].sublist[index4].sublist[index5].sublist[index6].randomfieldid == record.randomFieldId) {//第五层
                                                                datas[index2].sublist[index3].sublist[index4].sublist[index5].sublist[index6].cube_expandmap = JSON.stringify(cube_expandmap);
                                                                // break;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        //datas[index].cube_expandmap = JSON.stringify(cube_expandmap);
                        this.tableData.Data = datas;
                    }
                }
            } else {
                message.error(`${getLabel(127353, '错误')}`);
            }
        })
    }

    @action
    updateLikeOrDis = (billid, isshowlistspan, likesinfospan) => {
        this.newTable.datas = this.newTable.datas.map(item => {
            if (item.randomFieldId == billid) {
                if (isshowlistspan.length > 0) {
                    return { ...item, likesinfospan, isshowlistspan: JSON.stringify(isshowlistspan) }
                } else {
                    return { ...item, likesinfospan }
                }
            }
            return { ...item }
        })
    }

    @action
    doCustomButton = (record: any, _: string, operate: any, __: string) => {
        let otherpara = operate.otherpara as string;
        let otherparas = otherpara.split("+");
        let index = 0;
        for (index; index < otherparas.length; index++) {
            otherparas[index] = otherparas[index].replace("column:", "");
        }
        let url = operate.href;
        url = url.replace(/&amp;/g, '&');
        const modeOpenUrl = this.modeOpenUrl.bind(this, operate, record, operate.text);
        const createBARCode = this.createBARCode.bind(this, record.randomFieldId, operate.text);
        const viewLog = this.viewLog.bind(this, record.randomFieldId, operate.text);
        const createQRCode = this.createQRCode.bind(this, record.randomFieldId, operate.text);
        const toEdit = this.toEdit.bind(this, record.randomFieldId, operate.text);
        const doprint = this.doprint.bind(this, record.randomFieldId, operate.text);
        const toDel = this.toDel.bind(this, record.randomFieldId, operate.text);
        const doShare = this.doShare.bind(this, record.randomFieldId, operate.text);
        const expCard = this.expCard.bind(this, record.randomFieldId, operate.text);
        const openPageExpandLinkUrl = this.openPageExpandLinkUrl.bind(this, record.randomFieldId);
        if (url.startsWith('javascript:modeOpenUrl')) {//链接
            url = url.replace('javascript:', '');
        } else {//手动输入
            let n = url.lastIndexOf(',');
            if (n > 0) {
                url = url.substring(0, n);
            } else {
                let urls = url.split(')') as string[];
                url = urls[0];
            }
            url = url.replace('javascript:', '');
            url += (url.trim().endsWith('(') ? "" : ",") + "'" + record.randomFieldId + "'";
            if (otherpara) {
                url += ',';
                // if (operate.index && record['randomFieldOpPara' + operate.index] && record['randomFieldOpPara' + operate.index][0]) {
                //     otherpara = record['randomFieldOpPara' + operate.index][0].obj;
                // }
                let i = 0;
                let randomFieldOpPara = "";
                while (record[otherparas[i]] != undefined) {
                    let item = record[otherparas[i]];
                    if (record[otherparas[i] + "_value"]) {//分组列表因为返回的数据的原因,record中的列都是转化后值,不是数据库原始值
                        item = record[otherparas[i] + "_value"];
                    }
                    if (~item.indexOf('<') && ~item.indexOf('>')) {
                        //如果otherpara是标签,可能将引发eval中的内容为非标准字符串的问题，以及将会抛出标签，因此做过滤。
                        let text = item.replace(/"/g, "'");    //对双引号统一转引号
                        if (jQuery(text).length > 0) {   //利用jq获取innerHTML
                            text = jQuery(item).html();
                            item = text;
                        }
                    }
                    item = removeHTMLTag(item).replace(/[\r\n]/g, "");
                    randomFieldOpPara += item + "+";
                    i++;
                }
                randomFieldOpPara = randomFieldOpPara.substring(0, randomFieldOpPara.length - 1);
                otherpara = randomFieldOpPara;
                url += '\'' + otherpara + '\'';
            }
            url += ')';
        }
        if (modeOpenUrl || createBARCode || viewLog || createQRCode || toEdit || doprint || toDel || doShare || expCard || openPageExpandLinkUrl) {
            try {
                /****
                 * 为什么这个会有replaceE8Url ？
                 * onUrl('41','<a href="spa/xxxxx">就很真实</a>')
                 * 参数或有这个地址
                 */
                url = replaceE8Url(url);
                const func = eval(`${url}`);
                if (typeof func == 'function') {
                    func(record);
                }
            } catch (e) {
                message.error(e);
                throw e;
            }
        }
    }
    windowOpenOnSelf = (expandid: string, billid?: any) => {
        let billids = [] as any[];
        if (this.displayType === SearchDisplayType.Excel) {
            billids = this.excelStore.selectedRowKeys;
        } else {
            billids = this.newTable.selectedRowKeysAllPages.slice();
        }
        let url = this.urlMap[expandid];
        if (this.displayType == SearchDisplayType.TreeType && this.treeKey) {
            billids = _.uniq(this.treeKey.map(d => d.split('_')[0]));
            url += "&displayType=treeType";

        }
        if (!this.checkIsSelect(expandid)) {
            return
        }
        this.secondConfirmPrompt(expandid, () => {
            this.doInterfacesAction(billid ? [billid] : billids, expandid, this.windowOpenOnSelfCallBack, { url: url });
        })
    }
    windowOpenOnSelfCallBack = ({ url }: any) => {
        if (url) {
            window.location.href = replaceE8Url(url);
        }
    }
    checkIsSelect = (expandid) => {
        let isHasCheck: any
        this.rightMenus.map((item) => {
            item['key'] == expandid && item['isCheckSelectRow'] ? isHasCheck = item['isCheckSelectRow'] : ''
        })
        if (isHasCheck == 1 && !this.checkSeleted()) {
            return false
        } else {
            return true
        }
    }
    windowOpenOnNew = (expandid: string, billid?: any) => {
        let billids = [] as any[];
        if (this.displayType === SearchDisplayType.Excel) {
            billids = this.excelStore.selectedRowKeys;
        } else {
            billids = this.newTable.selectedRowKeysAllPages.slice();
        }
        let url = this.urlMap[expandid];
        if (this.displayType == SearchDisplayType.TreeType && this.treeKey) {
            billids = _.uniq(this.treeKey.map(d => d.split('_')[0]));
            url += "&displayType=treeType";

        }
        if (!this.checkIsSelect(expandid)) {
            return
        }
        this.secondConfirmPrompt(expandid, () => {
            this.doInterfacesAction(billid ? [billid] : billids, expandid, this.windowOpenOnNewCallBack, { url: url });
        })
    }
    windowOpenOnNewCallBack = ({ url }: any) => {
        this.refresh();
        var width = screen.availWidth - 10;
        var height = screen.availHeight - 50;
        var szFeatures = 'top=0,';
        szFeatures += 'left=0,';
        szFeatures += 'width=' + width + ',';
        szFeatures += 'height=' + height + ',';
        szFeatures += 'directories=no,';
        szFeatures += 'status=yes,toolbar=no,location=no,';
        szFeatures += 'menubar=no,';
        szFeatures += 'scrollbars=yes,';
        szFeatures += 'resizable=yes'; //channelmode
        window.open(replaceE8Url(url), '', szFeatures);
    }
    //页面扩展得方法执行
    doCustomFunction = (expandid: string, _?: any, billid?: any) => {
        let billids = [] as any[];
        if (this.displayType === SearchDisplayType.Excel) {
            billids = this.excelStore.selectedRowKeys;
        } else {
            billids = this.newTable.selectedRowKeysAllPages.slice();
        }
        let url = this.urlMap[expandid];
        if (this.displayType == SearchDisplayType.TreeType && this.treeKey) {
            billids = uniq(this.treeKey.map(d => d.split('_')[0]));
            if (url.indexOf("/cube/search") > -1) {
                url += "&displayType=treeType";
            }
        }
        if (!this.checkIsSelect(expandid)) {
            return
        }
        this.secondConfirmPrompt(expandid, () => {
            this.doInterfacesAction(billid ? [billid] : billids, expandid, this.doCustomFunctionCallBack, { url: url });
        });
    }
    doCustomFunctionCallBack = ({ url }: any) => {
        eval(url);
    }
    //二次确认提示
    secondConfirmPrompt = (pageexpandid: string, callBackFun: Function) => {
        let confirmContent = this.confirmMap[pageexpandid];
        if (confirmContent !== '' && confirmContent !== undefined) {
            confirmContent = this.getConfirmInfo(confirmContent);
            if (confirmContent == '') {
                return
            }
            if (_.trim(confirmContent)) {   //页面扩展得二次确认提示
                Modal.confirm({
                    title: <div dangerouslySetInnerHTML={{ __html: confirmContent }}/>,
                    okText: getLabel(382958, '继续'),
                    cancelText: getLabel(201, '取消'),
                    onOk: () => {
                        callBackFun();
                    },
                    onCancel() {
                    },
                });
                return;
            }
        }
        callBackFun();
        return true;
    }
    getConfirmInfo = (confirmContent) => {
        let info = '';
        if (confirmContent.startsWith('javascript:getConfirmMessage')) {
            let str = confirmContent.substring(confirmContent.indexOf('{') + 1, confirmContent.indexOf('}'));
            str = str.replace('return', '');
            try {
                info = eval(str);
            } catch (e) {
                message.error(getLabel('511399', '二次确认提示的js函数有错'));
            }
        } else {
            info = confirmContent;
        }
        return info;
    }

    //执行接口动作
    doInterfacesAction = (CheckedCheckboxIds: any[], pageexpandid: string, callBackFun?: Function, params?: any) => {
        if (CheckedCheckboxIds && CheckedCheckboxIds.length > 0) {
            const modeid = this.modeId;
            const formid = this.formId;
            API.doInterface({ pageexpandid, CheckedCheckboxIds, modeid, formid, ...this.params }).then(({ pageExpendResult, status }) => {
                if (pageExpendResult && pageExpendResult.haveError) {
                    showExpendError(pageExpendResult, this.getHref());
                    return;
                }
            });
        }
        setTimeout(() => {
            if (callBackFun) {
                if (params) {
                    callBackFun(params);
                } else {
                    callBackFun();
                }
            }
        })
    }

    getHref = () => {
        let href = "/spa/cube/index.html#/main/cube/search?";
        for (let parm in this.params) {
            href += parm + "=" + this.params[parm] + "&";
        }
        return href;
    }

    setTag = () => {
        let selectedRowKeysAllPages = _.uniq(this.newTable.selectedRowKeysAllPages.map(d => d.split('_')[0]));
        if (this.displayType == SearchDisplayType.TreeType && this.treeKey) {
            selectedRowKeysAllPages = _.uniq(this.treeKey.map(d => d.split('_')[0]));
        }
        if (this.selectRowkeys.length > 0) {
            selectedRowKeysAllPages = _.uniq(this.selectRowkeys.map(d => d.split('_')[0]));
        }
        if (selectedRowKeysAllPages && selectedRowKeysAllPages.length > 0) {
            this.tagVisible = true;
        } else {
            Modal.info({
                title: getLabel(15172, '系统提示'),
                content: getLabel(20149, '请至少选择一条记录。')
            })
        }
    }

    saveTabBatch = (para) => {//批量设置标签保存
        let params = { modeid: this.modeId, formid: this.formId, ...para };
        API.saveTabBatch(params).then(({ error, status }) => {
            if (status == '1') {
                message.info(getLabel(83551, '保存成功！'));
                this.tagVisible = false;
                this.refresh();
            } else {
                message.error(error)
                throw error;
            }
        })
    }

    @action
    slideflg = () => {
        return this.slideflgvla;
    }

    @action
    dosubmitfun = () => {
        this.dosubmitvla = true;
    }

    @action
    showSlideModal = (bool, url, percentage) => {
        if(this.parentSearch){
            this.parentSearch.showSlideModal(bool, url, percentage);
        }
        if (!this.isclick) {
            this.isclick = true;
            const _this = this;
            setTimeout(() => {
                _this.isclick = false;
            }, 300) //500ms内仅能点击一次
            url = replaceE8Url(url);
            //url = url.replace('/spa/cube/index.html#', '/spa/cube/index.jsp#');
            url = url.replace(/&_key=\w{1,10}&/g, '&');//去掉用户配置多加的key
            url = checkHref(url);
            if (bool) {
                if (this.slideModalUrlold == url) {
                    return;
                } else {
                    this.slideModalUrlold = url;
                }

                this.slideModalUrl = url;
                if (url.indexOf('?') != -1) {
                    this.slideModalUrl += "&time=" + new Date().getTime();
                }
                this.sliderPercentage = percentage;
            } else {
                this.slideModalUrlold = "";
                this.slideModalUrl = "";
                this.sliderPercentage = "";
                if (this.dosubmitvla) {
                    if (this.displayType === SearchDisplayType.Excel) {//excel列表
                        this.excelStore.getDatas(this.sessionKey, this.editPagination.current);
                    } else if (this.displayType === SearchDisplayType.TreeType) {
                    let params = Object.keys(this.getConditionValues()).length == 0 ? { ...toJS(this.quickSearchFormData), isQuickSearch: 1 } : this.getConditionValues();
                        this.dataKey({ ...this.params, ...params });
                    } else if (this.displayType === SearchDisplayType.ImgType || this.displayType === SearchDisplayType.VerticalType) {
                        this.dataKey({})
                    } else {
                        this.slideflgvla && window._table.reLoad();
                    }

                    this.slideModalUrl = url;
                    if (url.indexOf('?') != -1) {
                        this.slideModalUrl += "&time=" + new Date().getTime();
                    }
                    this.sliderPercentage = percentage;
                }

                this.dosubmitvla = false;
            }
            this.slideflgvla = bool;
            this.slideModalVisible = bool;
            //weaTop层级问题,列表内嵌卡片滑出头部被遮盖了
            if (bool) {
                jQuery('.wea-new-top-req-wapper .wea-new-top-req').css({ zIndex: 0 });
            } else {
                jQuery('.wea-new-top-req-wapper .wea-new-top-req').css({ zIndex: 1 });
            }
        }
    }

    @action
    showCubeMap = (bool: boolean, title: string = "") => {
        this.cubeMap = {
            visible: bool,
            location: title
        }
    }

    @action
    getIconInfo = (modeid) => {
        API.getAppInfoByID({ modeid }).then((data: any) => {
            if (data.status == "1") {
                this.iconInfo = {
                    icon: data.icon || "icon-coms-ModelingEngine",
                    iconColor: data.iconColor || "#fff",
                    iconBg: data.iconBg || "#96358a"
                };
            }
        })
    }

    @action
    getSingleExcelOut = (billid) => {    //列表的自定义按钮导出走接口和卡片一样的
        doExpCardConfig({ action: 'getExpList', modeid: this.modeId }).then((data: any) => {
            try {
                if (data.ExpList.length > 0) {
                    if (data.ExpList.length == 1) {   //当后台设置了一种导出类型的时候直接导出
                        window.open(`/weaver/weaver.formmode.expcard.servlet.ExpCardServer?action=expcard&fileType=${data.ExpList[0]['key']}&billid=${billid}&modeId=${this.modeId}`);
                    } else {
                        WeaTools.ls.set('cube_export_type', data.ExpList[0]['key']);
                        showExportMenu(data.ExpList, billid, this.modeId, "card", "", "", "", "");
                    }
                } else {
                    Modal.info({
                        title: getLabel(17416, '导出'),
                        content: (
                            <div>
                                {getLabel('500890', '模块没有设置导出文件类型，请联系管理员！')}
                            </div>
                        ),
                        onOk() {
                        },
                    });
                }
            } catch (error) {
            }
        })
    }

    @action
    reloadTabsAndCounts = () => {
        if (this.displayType == SearchDisplayType.ImgType) {
            if (!this.imgPageRefresh) {
                this.selectRowKeyAll(true);
            } else {
                this.imgPageRefresh = false;
            }
        }
        const params = { ...this.params, ...this.reloadParams };
        this.getCountData(params);
        this.getGroupData(params);
    }

    //**************数据筛选相关的**************** */
    @action
    resetMenu = (menuKey) => {
        this.checkLoading = true;
        this.oldMenueKey = menuKey;
        this.tempTabledatas = JSON.parse(JSON.stringify(this.newTable.datas));
        const isImgSearch = this.displayType == SearchDisplayType.ImgType;
        const isTree = this.displayType == SearchDisplayType.TreeType;
        const isVertical = this.displayType == SearchDisplayType.VerticalType;
        this.tempselectedRowKeys = (isImgSearch ||isVertical) ? this.selectRowkeys : this.newTable.selectedRowKeys
        let removeSelct = [] as any[];
        this.checkBtn = "expandid_" + menuKey + "span";
        let datas = [] as any[];
        datas = JSON.parse(JSON.stringify(this.newTable.datas));
        if (isTree) {
            datas = JSON.parse(JSON.stringify(this.tableData.Data));
            this.tempTabledatas = JSON.parse(JSON.stringify(this.tableData.Data));
            this.tempselectedRowKeys = this.selectedRowKeys;
            this.checkBtn = "expandid_" + menuKey;
        }
        datas.map((item) => {
            if (item[this.checkBtn] == "true") {
                item.randomFieldCk = "false";
                if (isTree) {
                    const tempid = item['key'] || item['id'] || item['randomFieldId'];
                    removeSelct.push(tempid);
                } else {
                    const imgId = item.randomFieldId ? (item.randomFieldSubKeyd_id != undefined ? `${item.randomFieldId}_${item.randomFieldSubKeyd_id}` : item.randomFieldId) : "";
                    removeSelct.push(imgId);
                }
                item.randomFieldOp = 'true';
            }
            if (isTree && item.sublist) {
                item.sublist = this.dealSubList(item.sublist, removeSelct);
            }
        })
        let rowkeys = _.difference(this.tempselectedRowKeys, removeSelct);
        this.filterSelectRows = removeSelct;
        if (isTree) {
            this.tableData.Data = JSON.parse(JSON.stringify(datas));
            this.selectedRowKeys = rowkeys;
            this.treeKey = rowkeys; //批量修改参数用的这个，这里筛选定义一下
        } else {
            this.newTable.tableUpdate({ datas: datas })
            this.newTable.selectedRowKeys = rowkeys;
            this.newTable.selectedRowKeysAllPages = rowkeys;
        }
        const rightMenustmp = this.rightMenus.filter(d => (d.isfilter == '1' && d.key == menuKey))
        const cancel = { function: "Cancel", icon: "icon-coms-go-back", key: "-100", name: getLabel(1, '取消'), quickButton: true }
        rightMenustmp.push(cancel);
        this.rightMenus = rightMenustmp;
        this.doRealAction = true;
        const _this = this;
        if (isImgSearch || isVertical) {
            this.selectRowkeys = rowkeys;
            this.setImgSelectValue(_.uniq(rowkeys.map(d => d.split('_')[0])).join(','));
        }
        setTimeout(() => {
            _this.checkLoading = false;
        }, 1000);
    }

    @action
    dealSubList(sublist, removeSelct) {
        let sublistDatas = [] as any[];
        sublistDatas = JSON.parse(JSON.stringify(sublist));
        const isTree = this.displayType == SearchDisplayType.TreeType;
        sublistDatas.map((item) => {
            if (item[this.checkBtn] == "true") {
                item.randomFieldCk = "false";
                if (isTree) {
                    const tempid = item['key'] || item['id'] || item['randomFieldId'];
                    removeSelct.push(tempid);
                } else {
                    removeSelct.push(item['id'] || item['randomFieldId']);
                }
                item.randomFieldOp = 'true';
            }
            if (item.sublist) {
                item.sublist = this.dealSubList(item.sublist, removeSelct);
            }
        });
        sublist = JSON.parse(JSON.stringify(sublistDatas));
        return sublist;
    }


    @action
    onclickCancel = () => {
        this.rightMenus = this.tempRightMenus;
        this.doRealAction = false;
        this.filterSelectRows = [];
        this.checkBtn = any;
        this.newTable.datas = this.tempTabledatas;
        this.newTable.selectedRowKeys = this.tempselectedRowKeys;
        this.newTable.selectedRowKeysAllPages = this.tempselectedRowKeys;
        if (this.displayType == SearchDisplayType.ImgType) {
            this.selectRowkeys = this.tempselectedRowKeys;
            this.setImgSelectValue(_.uniq(this.selectRowkeys.map(d => d.split('_')[0])).join(','));
        }
        if (this.displayType == SearchDisplayType.TreeType) {
            this.tableData.Data = this.tempTabledatas;
            this.selectedRowKeys = this.tempselectedRowKeys;
        }
    }

    @action
    backUpData = () => {
        let idarr = this.newTable.selectedRowKeysAllPages.slice();
        let idset = new Set();
        idarr.forEach(element => {
            idset.add(element.split('_')[0])
        });
        idarr = Array.from(idset);
        let ids = idarr.join(',');
        let content = getLabel('515098', '是否确认还原全部数据') + "？"
        if (ids != '') {
            content = getLabel('515099', '是否确认还原已勾选的数据') + "？"
        }
        let count = this.newTable.count;
        if (count <= 0) {
            Modal.info({
                title: getLabel(15172, '系统提示'),
                content: getLabel('515213', '暂无待还原数据'),
            });
        } else {
            Modal.confirm({
                title: getLabel(131329, '信息确认'),
                content: content,
                onOk: () => this.doBackUp(ids)
            });
        }
    }

    doBackUp = (ids) => {
        this.backupDataLoading = true;
        let parms = { ids: ids, customid: this.customId, backuplogid: this.params.backuplogid }
        API.backUpData({ ...parms }).then((data: any) => {
            this.backupDataLoading = false;
            if (data.status == "1") {
                Modal.success({
                    title: getLabel(131329, '信息确认'),
                    content: data.msg
                })
            }
            this.refresh();
        })
    }

    customSearch(arr: any) {
        if (arr == undefined || arr == null || !Array.isArray(arr)) {
            return;
        }
        let customparm = {};
        arr.forEach(element => {
            let key = 'con_' + element.fieldid;
            if (!element.isdel) {
                customparm[key] = element.value;
            }
            this.setValue(element);
        });
        this.customparms = customparm;
        this.refresh();
    }

    needSet = (fieldid) => {
        let result = false;
        this.conditionInfo[0].items.map(item => {
            const { domkey } = item;
            if (domkey[0] == "con_" + fieldid) {
                result = true;
            }
        });
        return result;
    }

    setValue(obj) {
        let { fieldid, fieldhtmltype, fieldtype, value, valueSpan, isdel = false } = obj;
        let valueObj: any = { id: value, name: valueSpan };
        if (!fieldid) {
            return;
        }
        if (fieldid && !this.needSet(fieldid)) {
            return;
        }
        if (isdel) {
            value = '';
            valueSpan = ''
            valueObj = {}
        }
        if (fieldhtmltype == '1' //文本类型
            || (fieldhtmltype == '5' && fieldtype == '1')) {//下拉框
            if (fieldhtmltype == '1' && fieldtype != '1') {
                let j = [] as any[];
                if (value == "-1" || value == "") {
                    this.condition.form.$("con_" + fieldid).value = j;
                } else {
                    let i = value.split(",");
                    this.condition.form.$("con_" + fieldid).value = i;
                }
            } else {
                this.condition.form.$("con_" + fieldid).set(value);
            }
        } else if (fieldhtmltype == '3') {
            if (fieldtype == '2' || fieldtype == '19' || fieldtype == '290'//日期 时间
                || '1' == fieldtype || '17' == fieldtype) {
                this.condition.form.$("con_" + fieldid).set(value);
            } else {
                this.condition.form.$("con_" + fieldid).value = value;
                this.condition.form.$("con_" + fieldid).valueObj = valueObj;
                this.condition.form.$("con_" + fieldid).valueSpan = valueSpan;
            }
        }
    }

    @action
    changeQuickSearchData = (domkey) => {
        this.quickSearchData.quicksearchinfo.map(item => {
            if (item.parentDomkey && item.parentDomkey[0] == domkey) {
                item.value = '';
                // todo
                // console.log(this.condition.form.getFormDatas())
                const conDatas = this.condition.form.getFormDatas();
                if (conDatas[item.domkey[0]]) {
                    this.condition.form.$(item.domkey[0]).value = '';
                }
                this.quickSearchFormData[item.domkey[0].split('_')[1]] = ''
                this.changeQuickSearchData(item.domkey[0]);
            }
        })
    }

    @action
    setQuickSearchInfo = (data = []) => {
        this.quickSearchData = { ...this.quickSearchData, quicksearchinfo: data }
    };

    //二次密码验证
    @action
    doSecondaryVirty = (params) => {
        const { getLabel } = WeaLocaleProvider;
        const url = `/spa/hrm/index_mobx.html#/main/hrmSingle/secondaryVerify/30`;
        const onSecondaryCancel = () => {

        }

        const onCallbackHandle = f => {
            if (f == 'success') {
                API.updateFreeSecretTime({ customid: params.customid, viewtype: params.viewtype }).then((data: any) => {
                    if (data.result) {
                        this.reloadSearch(params);
                        this.secondflag = false;
                    } else {
                        message.error(data.message);
                    }
                });

            }

        }
        const showSecondaryVirty = async () => {
            API.modeSecondaryVerify({ customid: params.customid, viewtype: params.viewtype }).then((data: any) => {
                if (data.status == '1') {
                    if (data.isNeedSecondPwdVerify) {
                        this.hasRight = false;
                        this.verified = true;
                        const style = { 'width': 600, 'height': 200 };
                        const secondaryVrifyDialog = WeaTools.createDialog({ moduleName: 'hrm', title: getLabel(501195, '身份验证'), url, style, callback: onCallbackHandle, onSecondaryCancel });
                        secondaryVrifyDialog.show();
                    }
                } else {
                    message.error(data.message);
                }
            });
        }
        showSecondaryVirty();
    }
    // 纵向列表数据
    selectVerticalRowKey = (value) => {
        this.verticalListStore.update({ rowCheckKey: [value] })
        if (this.disquerycheck != '1') {
            const selectRowkey: string[] = [];
            if (this.selectRowkeys.indexOf(value) > -1) {
                this.selectRowkeys.forEach((item) => {
                    if (item != value) {
                        selectRowkey.push(item);


                    }
                });
                this.selectRowkeys = selectRowkey;
            } else {
                this.selectRowkeys.push(value);
            }
            this.verticalListStore.update({ selectValue: _.uniq(this.selectRowkeys.map(d => d.split('_')[0])).join(',') });
        }


    }

    /***********************      查询统计      **************************** */
    /* 是否显示‘统计’下拉列表 */
    @action
    handleShowMoreCountData = (showMoreCountData) => {
        this.showMoreCountData = !showMoreCountData;
    }

    //-----------------------------------------------------------------------------------------------点击展示小卡片
    @action
    rowClickFun = (record, e) => {
        let currentTr = this._$(e.srcElement).closest('tr[class*="ant-table-row"]');
        if (currentTr[0]) {
            this.showRowClick(currentTr, record.randomFieldId, record.randomFieldSubKeyd_id);
        }
    }

    showRowClick = (currentTr, id, d_id) => {
        if (this.rowClick['1']) {//默认窗口
            API.getRowClickHref({ modeid:this.modeId,formid:this.formId,billid:id,id:this.rowClick['1'].id}).then((data: any) => {
                if (data.status == '1') {
                    if (data.href.startsWith('javascript:')) {
                        this.doCustomFunctionCallBack({ url: data.href });
                    } else {
                        top.window.location.href = data.href;
                    }
                } else {
                    message.error(data.message);
                }
            });
            return;
        }


        if (this.rowClick['2']) {//弹出窗口
            API.getRowClickHref({ modeid:this.modeId,formid:this.formId,billid:id,id:this.rowClick['2'].id}).then((data: any) => {
                if (data.status == '1') {
                    if (data.href.startsWith('javascript:')) {
                        this.doCustomFunctionCallBack({ url: data.href });
                    } else {
                        top.window.open(data.href);
                    }
                } else {
                    message.error(data.message);
                }
            });
        }
        if (this.rowClick['4']) {//右侧展开
            API.getRowClickHref({ modeid:this.modeId,formid:this.formId,billid:id,id:this.rowClick['4'].id}).then((data: any) => {
                if (data.status == '1') {
                    if (data.href.startsWith('javascript:')) {
                        this.doCustomFunctionCallBack({ url: data.href });
                    } else {
                        this.rightLayoutHref = data.href;
                    }
                    if (this.rowClick['4'].width) {
                        this.rightLayoutWidth = this.rowClick['4'].width;
                    } else {
                        this.rightLayoutWidth = '35%';
                    }
                } else {
                    message.error(data.message);
                }
            });
        }

        if (this.rowClick['5']) {//下方展示列表小卡片
            let nextTr = currentTr.next();
            if (nextTr[0]) {//如果存在下一个兄弟tr判断下一个兄弟是否是小卡片
                if (nextTr.attr('littleCard') == '1') {
                    if (nextTr.css('display') == 'none') {
                        this._$('tr[littleCard="1"]').css('display', 'none');
                        nextTr.css('display', 'table-row');
                    } else {
                        nextTr.css('display', 'none');
                    }
                } else {
                    this.littleCardContent(currentTr, id, d_id);
                }
            } else {//如果不存在则可能点击的是最后一行
                this.littleCardContent(currentTr, id, d_id);
            }
        }

        if (this.rowClick['3']) {//其它
            if (this.rowClick['3'].hreftarget.indexOf('$') > -1) {
            API.getRowClickHref({ modeid:this.modeId,formid:this.formId,billid:id,id:this.rowClick['3'].id}).then((data: any) => {
                    if (data.status == '1') {
                        this.doCustomFunctionCallBack({ url: data.href });
                    } else {
                        message.error(data.message);
                    }
                });
            } else {
                this.doCustomFunctionCallBack({ url: this.rowClick['3'].hreftarget });
            }
        }
    }


    @action
    littleCardContent = (currentTr, id, d_id) => {
        this._$('tr[littleCard="1"]').css('display', 'none');
        $('<tr littleCard="1"><td colspan="' + currentTr.children().length + '"><div id="littleCard_' + id + '_' + d_id + '" style="text-align:center;padding:5px;"></div></td></tr>').insertAfter(currentTr);

        const div = document.getElementById("littleCard_" + id + "_" + d_id);
        ReactDOM.render(<Spin spinning={true}/>, div);
        API.showLittleCard({ customid: this.customId, billid: id, d_id }).then((data: any) => {
            if (data.status == '1') {
                ReactDOM.render(<LittleCard width={this.rowClick['5'].width} canEdit={data.canEdit} onChange={(fieldid,value)=>{
                                                this.littleCardFieldChange(fieldid, value, id, d_id);
                                            }} datas={data.datas}/>, div);
            } else {
                message.error(data.message);
            }
        });
    }

    @action
    littleCardFieldChange = (fieldid, value, id, d_id) => {
        API.saveLittleCardFieldValue({ fieldid, value, id, d_id, modeid: this.modeId }).then((data: any) => {
            if (data.status == '1') {
                if (data.errorCode && data.errorCode == '-1') {
                    message.error(data.error);
                } else {
                    message.success(getLabel(83551, '保存成功！'));
                }
            } else {
                message.error(data.message);
            }
        });
    }

    /**获取当前的查询，提供给用到jquery操作dom的地方 */
    _$ = (selector) => {
        return $(`#cube_search_${this.params.customid}`).find($(selector)).not($(`div[id="cube_search_${this.params.customid}"] div[id^="cube_search_"]`).find($(selector)));
    }

    @action
    changeConditioninfo = (fieldid, v) => {
        this.conditionInfo[0].items.map(item => {
            const { domkey } = item;
            if (domkey[0] == "con_" + fieldid) {
                this.condition.form.$("con_" + fieldid).set(v);
            }
        });
    }

    @action
    changeConditioninfoForBrowser = (fieldid, ids, data, valueSpan) => {
        this.conditionInfo[0].items.map(item => {
            const { domkey } = item;
            if (domkey[0] == "con_" + fieldid) {
                this.condition.form.$("con_" + fieldid).value = ids;
                this.condition.form.$("con_" + fieldid).valueObj = data;
                this.condition.form.$("con_" + fieldid).valueSpan = valueSpan;
            }
        })
    }

    @action
    getCountData = (params) => {
        API.getCountData(params).then(action((res: any) => {
            if (res.status == '1') {
                this.countData = res.countData;
            }
        }))
    }

    @action
    getGroupData = (params) => {
        API.getGroupData(params).then(action(({ status, groupCount }) => {
            if (status == '1') {
                if (groupCount && this.top.selectedKey != 'empty') {  //未分组为0，则不显示
                    this.top.onHandleEmptyTab(groupCount['empty'])
                }
                this.top.update({ groupCount });
            }
        }))
    }

}

export default new listStore();
